1 /// <summary>2 ///verifies that a string was in valid e-mail format3 /// </summary>4 /// <param name= "email" >Email to verify</param>5 /// <returns>true if the string is a valid e-mail address and false if it ' s not</returns>6 Public Static BOOLIsValidEmail (stringemail)7 {8 if(string.isnullorempty (email))9 return false;Ten Oneemail =email. Trim (); A varresult = Regex.IsMatch (email,"^ (?: [\\w\\!\\#\\$\\%\\&\\ ' \\*\\+\\-\\/\\=\\?\\^\\ ' \\{\\|\\}\\~]+\\.) *[\\w\\!\\#\\$\\%\\&\\ ' \\*\\+\\-\\/\\=\\?\\^\\ ' \\{\\|\\}\\~][email protected] (?:(?:(?: [A-za-z0-9] (?: [ A-za-z0-9\\-] (?! \\.)) {0,61} [a-za-z0-9]?\\.) +[a-za-z0-9] (?: [a-za-z0-9\\-] (?! $)) {0,61}[a-za-z0-9]?) | (?:\ \[(?:(?: [01]?\\d{1,2}|2[0-4]\\d|25[0-5]) \ \.) {3} (?: [01]?\\d{1,2}|2[0-4]\\d|25[0-5]) \ \])) $", regexoptions.ignorecase); - returnresult; -}email message Format
C # Common format judgments