3

Lets say i have fallowing email address-

闪闪发光@闪闪发光.com 

how i can validate this email...so that user can not enter this type of email address.

Thanks in advance!!!

Vivek
  • 10,978
  • 14
  • 48
  • 66

3 Answers3

4
var email="闪闪发光@闪闪发光.com"
var match=email.match(/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/gi)
if(match)
{
    alert("correct");
}else
{
    alert("incorrect");    
}

Demo http://jsfiddle.net/usmanhalalit/JXJ5q/

Muhammad Usman
  • 12,439
  • 6
  • 36
  • 59
2

Don't validate email addresses.. The best way to go about it is to simply look for an '@' and no spaces, and then on your server validate by doing a domainname lookup.

Evert
  • 93,428
  • 18
  • 118
  • 189
1

A standard regex should be able to help, as it will disallow any characters other than the ones you specify. May want to take a look at: JQuery validate e-mail address regex

Community
  • 1
  • 1
Igor
  • 33,276
  • 14
  • 79
  • 112
  • Regex only works if you go for very simple checking. A full verification that can catch all valid and invalid will take many pages of regex due to all the exceptions, unicode and more. – David Mårtensson Apr 18 '16 at 08:18