drupal stats

Validate Email address using Regular Expression

July 3rd, 2011 Web Forms 1 Comment


using System.Text.RegularExpressions;

 

public static Boolean IsEmailValid(string EmailAddress)

{

    if (EmailAddress.Length > 0)

    {

        Regex regex = new Regex("(?<user>[^@]+)@(?<host>.+)");

        Match m = regex.Match(EmailAddress);

        if (m.Success && EmailAddress.Length == m.Length)

            return true;

        else            

            return false;

    }

    else        

        return false;

}

Tags: email validation using regular expression in asp net, telerik email regex, dot net validate email address, asp regularexpressionvalidator for email adress and clear textbox, net validator regular expression excel file, regular expression for email in win forms asp net, regular expression for email in windows form, regular expression in asp net for email and focus the textbox, using a regular expression for emails, how to validate regular exp the textbox in update mode in gridview

No related posts.

1 Comment

  1. [...] Load a txt file into TextBox Clear TextBox Using Javascript Clear TextBox on Focus in ASP.NET Validate Email address using Regular Expression Setting the value to textbox with password mode Get current page name in ASP.NET Get current URL [...]