Possible Duplicate:
What is the best regular expression for validating email addresses?
I'm using a form which ask for email address. I used regular expression for it as
.*@.*\..*
But it is not working fine for some of my test email id like
dsrasdf@@@[email protected]
Any one provide me regular expression for the email validation in asp.net or can i use any other method for it.
Please give your suggestions.
Best to rely on the framework for this kind of stuff.
try {
address = new MailAddress(address).Address;
} catch(FormatException) {
//address is invalid
}
I am using the following regular expression for my email validations (case insensitive):
^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$
I do not know about asp, but i think that you can use it like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With