// 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)(?:190[0-9]|19[1-9][0-9]|2[01][0-9]{2})(?=\d*ml)(*SKIP)(*FAIL)|\d{1,5}ml").unwrap();
let string = "Mary had a little lamb 1980750ml
Mary had a little lamb 2087750ml
Mary had a little lamb 1979750ml
Mary had a little lamb 1980750ml
Test 19819ml
Test 198218ml
Test 2123456ml
Test 20349876ml
Test 209912345ml
Test 1999123456ml
Test 987654321ml
Test 1988ml
Test 9999ml
Test 2000ml
Test 100ml
Test 22ml
Test 9ml
Test ml
";
let substitution = "";
// result will be a String with the substituted value
let result = regex.replace_all(string, substitution);
println!("{}", result);
}
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/