E-mail validation using regular expression

public bool IsValidEmail(string email)
string pat = @"^[-a-zA-Z0-9][-.a-zA-Z0-9]*@[-.a-zA-Z0-9]+(\.[-.a-zA-Z0-9]+)*\.
Regex check = new Regex(pat,RegexOptions.IgnorePatternWhitespace);
bool valid = false;

if (string.IsNullOrEmpty(email))
valid = false;
valid = check.IsMatch(email);
return valid;


Author: priya08 Nov 2008 Member Level: Bronze   Points : 0

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: