Reputation: 227
I've regular expression to validate the email address as below
var reg = /^([A-Za-z0-9_\-\+\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
please help me to validate the entered email so that the input box should accept all special characters listed below.
.!#$%^&*-=_+{}|/?`
thanks in advance
Upvotes: 0
Views: 2732
Reputation: 5674
E-mail addresses are barely worth validating as legitimate e-mail addresses can contain almost anything (why would you want to tell someone their e-mail address is not valid?). The only way to be sure anyway will be to send them an e-mail with a confirmation link in it. The fact of the matter is if you don't want to exclude any possibly valid e-mail addresses you'll end up with something really permissive like this: \w+\@\w+.\w+
Upvotes: 3