// 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<email_subject>(?<=,)[a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+(?=\s*(?:\w+=|,))))").unwrap();
let string = "2017-11-30T17:00:02.596Z,10.1.20.211,RenjuXXX,X.X.X.X,mxa-0003fe01.xx.renjj.com,;250 2.0.0 2ej1k6mass-1 Message accepted for delivery;ClientSubmitTime:,Outbound to Internet,SMTP,SEND,asadasdasd1212,<DM2PR0801MB07631A46D877CA83645A2407A5380@Renju.asdasd.prod.outlook.com>,b4b8c0b5-ce3b-4aca-8335-08d53813c96a,Jose.SantanaJr@baycare.org,250 2.1.5 Recipient ok,41758,1,,,RE: my CV,rsola@cmh.edu,rsola@cmh.edu,";
// 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/