// 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)jquery-?[0-9.]*(.min|.slim|.slim.min)?\.js").unwrap();
let string = "https://www.staging2.villageofalamance.com/wp-includes/js/jquery/jquery.min.js
https://www.staging2.villageofalamance.com/wp-includes/js/jquery/jquery.js
https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.js
https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js
https://code.jquery.com/jquery-3.5.1.min.js
https://code.jquery.com/jquery-3.5.1.js
https://code.jquery.com/jquery-3.5.1.slim.js
https://code.jquery.com/jquery-3.5.1.slim.min.js
https://c0.wp.com/c/5.2.2/wp-includes/js/jquery/jquery.js
## Shouldn't be excluded
https://www.staging2.villageofalamance.com/wp-content/plugins/league-table/public/assets/js/tablesorter/jquery.tablesorter-min.js?ver=2.08
https://www.staging2.villageofalamance.com/wp-content/themes/bridge/js/plugins/jquery.appear.js?ver=5.6
https://www.staging2.villageofalamance.com/wp-content/themes/bridge/js/plugins/jquery.flexslider-min.js?ver=5.6";
// 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/