// 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).*@softcomputer\.com>? *(?:"? *<\S+> *)?$"#).unwrap();
let string = "== Real scc
Mary Bills <marybil@softcomputer.com>
<ellie@softcomputer.com>
<thereasaw@softcomputer.com>
test@softcomputer.com
<test@softcomputer.com>
olexiyry@softcomputer.com <olexiyry@softcomputer.com>
Deseriee Harkins <deseriee@softcomputer.com>
== Forged scc
Dorota Mazurek <dorotam@softcomputer.com> <reservations@nesthotel.com>
Nikki Taft <nicolet@softcomputer.com> <Muhammad.owais@abtach.com>
Lynette Didia <ldidia@softcomputer.com> <Muhammad.owais@abtach.com>
Dorota Mazurek <dorotam@softcomputer.com> <centralbookings@kbcsa.co.za>
Jeffrey Marr <jeffreym@softcomputer.com> <srvadv5.blr@vw-ppsmotors.co.in>
Iryna Dmytriyeva @SCC <idmy@softcomputer.com> <sc@grupoinrexsa.com>
Vickie Nix vickieh@softcomputer.com <m.recovery@albarondebt.com>
Bill Young <billyo@softcomputer.com> <sara@eaurenaissance.com>
== Questionable
\"Kurt Veith <kurtv@softcomputer.com>\" <marlene.robles@mld.com.mx>
\"softcomputer.com\" <MAIL.QUOTA@servers.com>
\"marksm@softcomputer.com\" <mark560sl@gmail.com>
== Valid non-forged addresses
\"sarahze@softcomputer.com via Smartsheet\" <user@smartsheet.com>
\"yuvi softcomputer.com\" <hugginshospital.notification@zixmessagecenter.com>
<technicalsupport@softcomputer.com.au>
\"Secure Email From yevgeny@softcomputer.com via Message Pickup Center\" <emx-intermedia@securemail.intermedia.net>
\"Secure Email From yevgeny@softcomputer.com via Message Pickup Center\" <emx-intermedia@securemail.intermedia.net>
\"mpettis@softcomputer.com via SurveyMonkey\" <member@surveymonkeyuser.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/