.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Code Snippets >> Regular Expressions >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Vaidation Of Email Address

Posted By:Ghanashyam Nayak       Posted Date: September 09, 2010    Points: 10    Category: Regular Expressions    URL: http://www.dotnetspark.com  

Check Validation For Email Address Using Regex(Regular Expression)...

01.protected void Button3_Click(object sender, EventArgs e)
03.    System.Text.RegularExpressions.Regex ObjRegex = newSystem.Text.RegularExpressions.Regex(@"^(^[a-zA-Z]([a-z0-9A-Z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-zA-Z]([a-z0-9A-Z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i|(^[a-zA-Z]([a-z0-9A-Z_\.]*)@([a-z_\.]*)(\.[a-z]{2})(\.[a-z]{2})*$)/i$");
04.        if (ObjRegex.IsMatch(txtdays.Text))
05.        {
06.            Label3.Text = "Valid Email Address.";
07.        }
08.        else
09.        {
10.            Label3.Text = "InValid Email Address.";
11.        }


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend