// 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"(?P<Position>[A-Z][a-z]+){0,}(?P<FullName>(?P<FirstName>[A-Z][a-z]+)\s(?P<LastName>[A-Z][a-z]+))(?P<SocialNumber>\d{3}-\d{3}-\d{4})(?P<email>[\w\.-]+@[\w]+\.[a-z]+)").unwrap();
let string = "Norbert Vinson385-868-1852nvinson8@hotmail.comMilton Wade931-883-8104mwade90@gmail.comLauren Barnett573-991-4106lbarnett80@sbcglobal.netCary Kirby859-271-7097ckirby9@msn.comBiostatisticianClark Salinas845-641-5553csalinas16@mac.comOfficerHugo Cross500-760-4858hcross@optonline.netAssistantDomenic Molina256-975-9610dmolina@me.com";
// 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/