/ Published in: C#

A simple utility method to validate an Inputted Email Address.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static bool IsValidEmail(string email) { string pattern = @"^(([^<>()[\]\\.,;:\s@\""]+" + @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@" + @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" + @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+" + @"[a-zA-Z]{2,}))$"; Regex regex = new Regex(pattern); return regex.IsMatch(email); }
Comments
