The task at hand is to validate the Textbox in asp.net for a valid email address.
We can attach a RegularExpressionValidator to the text box with the following regular expression:
<asp:RegularExpressionValidator ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" ID="rxpEmail" runat="server"
ErrorMessage="Email Address is not valid" Text="*" Display="Static" ControlToValidate="txtEmail"></asp:RegularExpressionValidator>
UPDATES
Well i searched the net for the standards of a valid email id and i came across with a wonderful article at
I Knew How To Validate An Email Address Until I Read The RFC
It gives a an idea of what an exact RFC standard for the email id is.
I believe that we should follow validations which are quite obvious to the users and allow only standard email addresses.

JL
I don’t understand the right part of the regex.
It would match:
name1.name2@mail.123
I don’t think tld can be numbers.
Ankit Goyal
i think we can have email ids of type
abc@cmpnyname.local1
David
“+” is also valid character.
e.g.
yourname+thispartgetsignored@gmail.com
is equivalent to:
yourname@gmail.com
Ankit Goyal
new info for me….
have never tried this…i will work on it…
thnkss david…
Micah Burnett
I prefer a dumbed down the expression that catches most of the real-world problems instead of verifying every possible combination. The ultimate validation is when the mail server rejects the address…then you know for sure!
Our Republic
Ankit Goyal
Micah u r rite as the ultimate validation for a email address is achieved when we ping the mail server for the specified email address…
john
Hi, I could see one nice method here http://www.Tctcworld.com. if u need go through it..
Craig
If you want to validate e-mail addresses by pinging their mail server just use EmailVerify.NET, a .NET component which can test e-mail syntactically, verify the DNS MX records for the each domain and connect to each mail server to check if the mailbox exists or not.
It works like a charm!!
There’s also a nice demo on their website: http://www.emailverify.net
Hope this helps.
Margish
This worked for my task
[a-z]*\.*[a-z]*@[a-z]*\.[a-z]*
Javin Paul
Does regular expression remains same across language e..g rregex in unix, regex in java , regex in perl
are all they exactly same ?
Jared
I wrote a regular expression for validating an email address that is quite short and quite accurate, but I am trying to get more feed back.
Regular Expressions in C# (including a new comprehensive email pattern)
http://www.rhyous.com/2010/06/15/regular-expressions-in-cincluding-a-new-comprehensive-email-pattern/
I tried yours and it missed about 1/4th the emails in my list and so I thought maybe you could try mine and see if you get more accurate results or if mine has problems I don’t know about.
Blanche Mccleaf
Howdy. Basically want to comment and express that I admired this post. I’ll be bookmarking your web-site and checking to see if you post any new ones. Thanks so much!
Tonja Breyfogle
Hello there, simply become aware of your weblog through Google, and found that it is truly informative. I am going to be careful for brussels. I’ll appreciate in the event you continue this in future. Many other folks will likely be benefited out of your writing. Cheers!|
ipad screen repair petaling Jaya
Greetings! Very helpful advice within this article!
It’s the little changes which will make the greatest changes. Many thanks for sharing!
iphone repair kuala lumpur
If some one wants to be updated with hottest technologies then he
must be visit this web page and be up to date all the
time.