Return to Snippet

Revision: 56490
at March 31, 2012 00:13 by ryanfiorini


Initial Code
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);
    }

Initial URL

                                

Initial Description
A simple utility method to validate an Inputted Email Address.

Initial Title
Email Validator

Initial Tags
email

Initial Language
C#