fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string email = "an.email@ahost.com";
  9. string regex = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
  10.  
  11. Regex rgx = new Regex(regex);
  12.  
  13. Boolean result = rgx.IsMatch(email);
  14. System.Console.WriteLine("{0} validation is {1}", email, result.ToString());
  15. }
  16. }
Success #stdin #stdout 0.09s 24560KB
stdin
Standard input is empty
stdout
an.email@ahost.com validation is True