// 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"(?im)(?:\.?\/?.+\/)?(?:app(?:[0-9A-F]+)?|(?:jquery|angular|three)(?:\-?\d[\-\.]\d[\-\.]\d)?)(?:\.min)?\.js$").unwrap();
let string = "jquery.min.js
app.min.js
app.js
app4eefa86.min.js
jquery-3.2.1.js
jquery-3-2-1.min.js
/js/app.min.js
./scripts/jquery.js
/cgi-bin/angular.min.js
";
// 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/