// 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"7(?:1(?:7(?:24|3[01]|4[79]|5[089]|6[258])|8(?:3[49]|40|54)|9(?:0[1239]|1[034]|37|49|5[16]|6[48]))|2087|55(?:0[13457]|59|6[179]|7[034]|99))%").unwrap();
let string = "71901%
71902%
71903%
71909%
71910%
71911%
71912%
71913%
71914%
71949%
71950%
71951%
71956%
71964%
71968%
72087%
71834%
71937%
71839%
71840%
71854%
71724%
71730%
71731%
71747%
71749%
71750%
71758%
71759%
71762%
71765%
71768%
75501%
75503%
75504%
75505%
75507%
75559%
75561%
75567%
75569%
75570%
75573%
75574%
75599%
";
// 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/