International Email Address Validation With JavaScript

July 17, 2018 by Andreas Wik

Email validation can be quite tricky. While there are a lot of regular expressions out there that you can easily find by quickly Googling, many of them lack something crucial: they don’t let through international email addresses with unicode characters.

Traditional email addresses are generally limited to characters from the english alphabet, numbers and a set of special characters such as dots (.) and underscores (_). 

But what about all the international email addresses out there containing letters from other alphabets. Chinese, Japanese, Arabic. Or European languages such as German or Danish.

The CodePen below is using a regular expression that kiiinda gets the job done. But only for the local part (the part before the @). Try the following addresses:

用户@maimail.com
用户@例子.广告

See the Pen Non International Email Validation by Andreas Wik (@andreaswik) on CodePen.

Only the first one is allowed through. However, both of them are valid email addresses. A real world example is the government of Rajasthan in India that is handing out email addresses looking like:

xyz@राजस्थान.भारत

 

“Okay, okay, I get it. Do you have solution for me?!”

Yes. In the CodePen below you’ll find a regex which will get the job done. Try these valid email addresses out:

θσερ@εχαμπλε.ψομ
अजय@डाटा.भारत

örjan@örjan.se

See the Pen International Email Validation by Andreas Wik (@andreaswik) on CodePen.

 

They all get through as they should! And non valid addresses such as billy@bullsh!t.com are still denied.

Yay! Less users failing to sign up for your amazing service.

Share this article

Recommended articles