The task at hand is to validate the Textbox in 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>

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.

kick it on

Shout it

pimp it

Anky Goyal

I am MCPD certified in .NET and working on .NET technologies for past 3yrs. I am very passionate about the new features which get introduced in the technology. I am here to share the new features i get to know in the world of Microsoft. Follow me on twitter @ankygoyal [email protected]Ankit Goyal

More Posts - Website

  • JL

    I don’t understand the right part of the regex.
    It would match:
    [email protected]

    I don’t think tld can be numbers.

  • David

    “+” is also valid character.


    [email protected]

    is equivalent to:

    [email protected]

    • new info for me….
      have never tried this…i will work on it…
      thnkss david…

  • Pingback: DotNetShoutout()

  • 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

    • 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…

  • Pingback: DotNetBurner - C#()

  • Pingback:

  • Hi, I could see one nice method here 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:

    Hope this helps.

  • Margish

    This worked for my task

  • Does regular expression remains same across language e..g rregex in unix, regex in java , regex in perl

    are all they exactly same ?

  • 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)

    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.

  • 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!

  • 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!|

  • Greetings! Very helpful advice within this article!

    It’s the little changes which will make the greatest changes. Many thanks for sharing!

  • 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

  • Spot on with this write-up, I truly believe this site needs a great deal more attention. I’ll probably be returning to read through more, thanks for the advice!

  • Hi there! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in trading links or maybe guest writing a blog article or vice-versa? My site goes over a lot of the same subjects as yours and I feel we could greatly benefit from each other. If you’re interested feel free to send me an e-mail. I look forward to hearing from you! Wonderful blog by the way!

  • 5ReubenPrado

    Thoughtful article – BTW , others have been needing a a form , my friend came across a fillable document here