Skip to content

Instantly share code, notes, and snippets.

@kirillrybin
Created November 8, 2013 10:19
Show Gist options
  • Save kirillrybin/7369079 to your computer and use it in GitHub Desktop.
Save kirillrybin/7369079 to your computer and use it in GitHub Desktop.
/// <summary>
/// Validate Email Address
/// </summary>
/// <param name="email"></param>
/// <returns></returns>
private static bool IsValidEmail(string email)
{
var r = new Regex(@"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$");
return !string.IsNullOrEmpty(email) && r.IsMatch(email);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment