// 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)[^\/]*").unwrap();
let string = "3682/miniperfume-candy.jpg
3681/miniperfume-candy.jpg
4252/parfem-acqua-woman.jpg
4253/parfem-acqua-woman.jpg
3658/miniperfume-acqua-woman.jpg
3659/miniperfume-acqua-woman.jpg
3798/50ml-adriana.jpg
2103/miniparfemy-adriana.jpg
2104/miniparfemy-adriana.jpg
4254/parfem-adriana.jpg
4255/parfem-adriana.jpg
3800/50ml-adriana-rose.jpg
3801/50ml-adriana-rose.jpg
4256/adriana-rose.jpg
4258/adriana-rose.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/