Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript Email Validation when there are (soon to be) 1000's of TLD's?

I just read an article which states:

Internet domain addresses opened up to wave of new suffixes

Internet naming board approves huge expansion of approved domain extensions with .hotel, .bank, or .sport auctions likely.

Twenty-six years after .com was first unveiled to the world, officials have swept away tight regulations governing website naming, opening up a whole world of personalised web address suffixes.

But... I just learned how to validate email addresses by checking (among others variables) the number of characters used after the dot (i.e., .com, .fr, etc.). What now?

Analysts say they expect 500 to 1,000 domain suffixes, mostly for companies and products looking to stamp their mark on web addresses, but also for cities and generic names such as .bank or .hotel.

Maybe this is not a problem. But how are we going to validate email addresses? What’s the plan?

like image 454
sleeper Avatar asked Nov 29 '22 16:11

sleeper


2 Answers

IMO, the answer is to screw email validation beyond <anything>@<anything>, and deal with failed delivery attempts and errors in the email address (both of which are going to happen anyway).

Related:

  • How far should one take e-mail address validation?
like image 69
3 revs, 3 users 82% Avatar answered Dec 06 '22 09:12

3 revs, 3 users 82%


As I've answered elsewhere, this regex is pretty good at handling localization and the new TLDs:

(?!^[.+&'_-]*@.*$)(^[_\w\d+&'-]+(\.[_\w\d+&'-]*)*@[\w\d-]+(\.[\w\d-]+)*\.(([\d]{1,3})|([\w]{2,}))$)

It does validate Jean+Franç[email protected] and 试@例子.测试.مثال.آزمایشی, but it does not validate weird abuse of those nonalphanumeric characters, for example '[email protected]'.

like image 24
TombMedia Avatar answered Dec 06 '22 08:12

TombMedia