liferay / liferay-mobile-sdk

Other
47 stars 56 forks source link

Change email validation regexp #25

Closed wkubiak closed 8 years ago

wkubiak commented 8 years ago

I discovered this while implementing Liferay API communication in an app. The validator class didn't recognize a valid email address with a 4+ character TLD.

The regexp originally used is a bit too restrictive, especially with limiting the TLD to be between 2 and 4 characters long, which by today's standards isn't a good assumption. As proof, here's the current IANA list for TLDs: https://data.iana.org/TLD/tlds-alpha-by-domain.txt

Also, I checked the Android source code in Java and I noticed that a different, less restrictive pattern was used there.

In the proposed change, I decided to copy the Java code regexp and replaced the one used in the iOS version.

brunofarache commented 8 years ago

Just started reviewing :)

:octocat: Sent from GH.

brunofarache commented 8 years ago

Thanks @wkubiak I merged it.

brunofarache commented 8 years ago

@wkubiak can you give me an example of email address that wasn't working? I would like to add it to the ValidatorTest.

wkubiak commented 8 years ago

Thanks @brunofarache.

Examples: liferay@ios.works someperson@italy.travel