📅  最后修改于: 2022-03-11 14:49:24.812000             🧑  作者: Mango
use regex::Regex;
let email_regex = Regex::new(r"^([a-z0-9_+]([a-z0-9_+.]*[a-z0-9_+])?)@([a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6})").unwrap();
println!(" is valid: {} ", email_regex.is_match("xyz"));
println!(" is valid: {} ", email_regex.is_match("foo@bar.com"));