9 September 2010

E-mail Validation Using REGEX

E-mail Validation Using REGEX

string email = txtEmail.Text.ToString();
string pattern = @"^[a-z][a-z|0-9|]*([_][a-z|0-9]+)*([.][a-z|" + @"0-9]+([_][a-z|0-9]+)*)?@[a-z][a-z|0-9|]*\.([a-z]" + @"[a-z|0-9]*(\.[a-z][a-z|0-9]*)?)$";
System.Text.RegularExpressions.Match match = Regex.Match(email, pattern, RegexOptions.IgnoreCase);
if (match.Success)
{
}
Else
{
{
MessageBox.Show("Don't Leave the Field Empty", "Name Entry Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

No comments:

Post a Comment

Comments Welcome

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...