// 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" .+\.rtf ").unwrap();
let string = "rxn of glucose.png Screen Shot 2017-07-17 at 8.25.30 AM.png Screen Shot 2017-08-18 at 11.23.21 AM.png Screen Shot 2017-08-18 at 11.36.27 AM.png Screen Shot 2017-08-19 at 6.06.19 AM.png SSS.rtf Untitled 2.rtf Untitled 3.rtf Untitled 4.rtf Untitled.rtf";
// 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/