// 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)((?:|\s)\w+(?:\.|))(?:|,|\.)\s(\d+)").unwrap();
let string = "Av. Moinho Fabrini, 600 - Independencia, Sao Bernardo do Campo - SP, 09862-160
SAO BERNARDO DO CAMPO STATE OF SAO PAULO BRAZIL RUA VICENTE DE CARVALHO 197 09726 600
RUA JOAO PESSOA, 420, CENTRO, SAO BERNARDO DO CAMPO - SAO PAULO, 09715-000, BRASIL
AV. ROBERT KENNEDY. 3095 - ASSUNCAO SAO BERNARDO DO CAMPO - SP. 09860-215";
// 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/