// 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)B[lr]?il?aul?[td]").unwrap();
let string = "Healer's Briault renamed to Healer's Bliaut
Cleric's Briault renamed to Cleric's Bliaut
Hlr. Briault +1 renamed to Hlr. Bliaut +1
Clr. Briault +1 renamed to Clr. Bliaut +1
Orison Bliaud renamed to Orison Bliaut
Orison Bliaud +1 renamed to Orison Bliaut +1
Orison Bliaud +2 renamed to Orison Bliaut +2
Clr. Briault +2 renamed to Clr. Bliaut +2
Ebers Bliaud renamed to Ebers Bliaut
Ebers Bliaud +1 renamed to Ebers Bliaut +1
Gende. Bilaut +1 renamed to Gende. Bliaut +1
Piety Briault renamed to Piety Bliaut
Piety Briault +1 renamed to Piety Bliaut +1
Piety Briault +2 renamed to Piety Bliaut +2
Piety Briault +3 renamed to Piety Bliaut +3
Theo. Briault renamed to Theo. Bliaut
Theo. Briault +1 renamed to Theo. Bliaut +1
Theo. Briault +2 renamed to Theo. Bliaut +2
Theo. Briault +3 renamed to Theo. Bliaut +3";
// 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/