Home  »  Code Snippets  »  C#.Net  »

Validate Email using RegEx in C#.Net

 Posted By : Manoj SahooPosted Date : 16/11/2010 01:32:41 PM Category : C#.Net Points : 3

use below code to validate Email id.

using System.Text.RegularExpressions;

public static bool isEmail(string Email)
    {
        string pattern = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" +
               @"0-9]+([_][a-z|0-9]+)*)[email protected][a-z][a-z|0-9|]*\.([a-z]" +
               @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
        Regex re = new Regex(pattern);
        if (re.IsMatch(Email))
            return (true);
        else
            return (false);
    }

Thank You.

Responses
No responses found for this thread. Be the first to respond this thread.
Post Reply
Login to post Response.