// 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)(?<=;\/wp-content\/uploads\/)(.*?)(?=\.jpg)").unwrap();
let string = "<div class=\"js-aem-gallery\" data-images></div>
<div class=\"js-aem-gallery\" data-images=\"{"omniture":{"type":"","hasImpression":false},"slides":[{"title":"","omniture":null,"description":"","path":"/wp-content/uploads/auto-shows/frankfurt/2017/2019-porsche-cayenne/02-2019-porsche-cayenne-turbo-NP.jpg","thumbnail":"/wp-content/uploads/auto-shows/frankfurt/2017/2019-porsche-cayenne/02-2019-porsche-cayenne-turbo-NP.jpg?w=320&h=240&crop=1"},{"title":"","omniture":null,"description":"","path":"/wp-content/uploads/make/porsche/cayenne/2019/oem/21-2019-porsche-cayenne.jpg","thumbnail":"/wp-content/uploads/make/porsche/cayenne/2019/oem/21-2019-porsche-cayenne.jpg?w=320&h=240&crop=1"},{"title":"","omniture":null,"description":"","path":"/wp-content/uploads/make/porsche/cayenne/2019/oem/23-2019-porsche-cayenne.jpg","thumbnail":"/wp-content/uploads/make/porsche/cayenne/2019/oem/23-2019-porsche-cayenne.jpg?w=320&h=240&crop=1"},{"title":"","omniture":null,"description":"","path":"/wp-content/uploads/make/porsche/cayenne/2019/oem/30-2019-porsche-cayenne.jpg","thumbnail":"/wp-content/uploads/make/porsche/cayenne/2019/oem/30-2019-porsche-cayenne.jpg?w=320&h=240&crop=1"}]}\"></div>";
// 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/