Skip to content

Instantly share code, notes, and snippets.

@jltrem
Created August 3, 2014 01:30
Show Gist options
  • Save jltrem/b5487fe764fd9b82edd8 to your computer and use it in GitHub Desktop.
Save jltrem/b5487fe764fd9b82edd8 to your computer and use it in GitHub Desktop.
validate an email address
string regex = @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z";
bool isEmail = Regex.IsMatch(emailString, regex, RegexOptions.IgnoreCase);
@jltrem
Copy link
Author

jltrem commented Aug 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment