// 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)(?i)(?<=,|^)(?:(?!\b(?:city|disc?trict|street|plaza|square|tower|block|mansion|garden|house|building)\b)[^,])*(?=,|$)").unwrap();
let string = "big fake plaza, 12 this street, district, city
Green mansion, district, city
Block 7c of orange building district, city
98 main street block a blue plaza, city
tower 10, caribbean coast, district
block 3a, the latitude, city
blue red mansion, 46 pearl street, city
dorsett hotel, city
block 9, Willowland, disctrict, city
tower 2, the coronation, 1 fake street, district
";
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/