kiểm tra giá trị email - validates an email address


private static readonly Regex emailRegex = new Regex(
 @"^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$", RegexOptions.IgnoreCase)
public static bool IsEmailValid(string email)
{
     if (!string.IsNullOrWhiteSpace(email))
     {
          return emailRegex.IsMatch(email.Trim());
     }

     return false;
}

kiểm tra giá trị email - validates an email address
Share To:

laptrinhvien

Post A Comment:

0 comments so far,add yours