1         /// <summary>
 2         /// Verifies that a string is in valid e-mail format
 3         /// </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 bool IsValidEmail(string email)
 7         {
 8             if (String.IsNullOrEmpty(email))
 9                 return false;
10 
11             email = email.Trim();
12             var result = Regex.IsMatch(email, "^(?:[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\`\\{\\|\\}\\~]+\\.)*[\\w\\!\\#\\$\\%\\&\\'\\*\\+\\-\\/\\=\\?\\^\\`\\{\\|\\}\\~]+@(?:(?:(?:[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);
13             return result;
14         }
Email邮件格式

相关文章:

  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-12-20
  • 2022-12-23
  • 2021-06-13
猜你喜欢
  • 2021-10-20
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案