// 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"(?mi)\bCourt\h+(?:Case\h+Fee|Filing Fee:)\h+(?:Contract\h+)?\$\K\d+\.\d+").unwrap();
let string = "Court Case Fee $214.00 Payment Service Fee $6.91 E-File Fee $25.00
Court Filing Fee: Contract $198.00eFiling Fee $30.00Convenience Fee $8.28Total $236.28";
// 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/