// 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)\/s1600-h\/[^\/\s'"]+"#).unwrap();
let string = "http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYijDxlcBEI/AAAAAAAAAEU/DDbPKl6WZ30/s1600-h/tedsobject.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYijDxlcBEI/AAAAAAAAAEU/DDbPKl6WZ30/s400/tedsobject.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYgspBlcBDI/AAAAAAAAAEI/rNF6YqYaaaA/s1600-h/artoutoftimebook.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYgspBlcBDI/AAAAAAAAAEI/rNF6YqYaaaA/s400/artoutoftimebook.jpg
http://localhost/wpcomics/wp-content/images/_Tkt_A2r1p6I/RYaXmhlcBCI/AAAAAAAAAD8/YL8YxxkAAzk/s1600-h/funnyfables.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/