// 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).*(?<!_[0sml])\.jpg$").unwrap();
let string = "9Uikt/ifehr54mg__0.jpg
9Uikt/idg4hdmg2_s.jpg
9Uikt/igdffgggfmg4_m.jpg
9Uikt/img3teg3gegg7_l.jpg
9Uikt/imgerhw45h70.jpg
9Uikt/imggq4ge37s.jpg
9Uikt/img3f37m.jpg
9Uikt/img34g3f7l.jpg
9Uikt/imgf3f34t4t73l_.jpg
9Uikt/imgf3f34t4t73l_2.jpg";
// 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/