// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)\.[A-Za-z]+\.\d+").unwrap();
let string = "aaa/prt001.prt.1
aaa/prt001.prt.2
aaa/prt001.prt.3
aaa/prt001.prt.4
aaa/prt001.prt.5
aaa/prt001.prt.10
aaa/prt001.asm.1
aaa/prt001.asm.2
aaa/prt001.asm.3
aaa/prt001.txt.10
aaa/prt001.txt.20
aaa/prt001.txt.30
bbb/prt001.prt
bb/prt.001.prt
bb/prt.001.prt.1
bb/prt.001.1
bb/prt.ppp.prt";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/