// 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)^((?<AddressType>\w+\s*)?(?<Unit>\d+\s*)\/)?(?<StreetNumber>(\s*(\d+\w+)+)|((\s*\d+\s*\-\s*\d+)))(?<StreetNameAndType>(?<StreetType>\s+\w+)+)\s*[,|.]?\s*(?<Suburb>[\w\s]+)\s+(?<PostCode>\d{4})$").unwrap();
let string = "1 / 124 OLD SOUTH HEAD RD,VAUCLUSE 2030
37A DAINTREE CL, SOUTH BOWENFELS NSW 2790
unit 11/18-22 bernecker st .Carina 4152
445 VICTORIA RD,RYDALMERE 2116
";
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/