Posted By

kat on 06/11/10


Tagged

regex emailAddress


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

lucaubiali
franksmile0310


Email Regex


 / Published in: C#
 

from http://support.microsoft.com/kb/308252

  1. private static readonly string EmailAddressRegex = "(?<user>[^@]+)@(?<host>.+)";
  2. Regex regex = new Regex(EmailAddressRegex);
  3. Match emailMatch = regex.Match(LinkTarget.Text);
  4.  
  5. if (emailMatch.Success)
  6. {
  7. //do something it was an email address
  8. //

Report this snippet  

You need to login to post a comment.