Posted By

mamoo on 10/17/08


Tagged

regex email c


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

robe
umang_nine
khouser
tonicglop


Validate email list through Regex


 / Published in: C#
 

URL: http://cairocafe.blogspot.com/2006/05/regex-validating-csv-email-addresses.html

  1. Regex matchRegex = new Regex(@"[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{2,5}");
  2. MatchCollection matches =
  3. matchRegex.Matches("[email protected], [email protected],[email protected]");
  4. if ( matches.Count > 0)
  5. {
  6. for ( int i = 0; i <>
  7. {
  8. // You can process the email matched
  9. // for example you can check if it's a real email address or not.
  10. // by pinging the mail provider.
  11. ProcessEmailAddress(matches[i].Value);
  12. }
  13. }

Report this snippet  

You need to login to post a comment.