Tuesday, September 27, 2016

Google's Email Validator Regular Expression

I am anticipating the release of the Google Home device.  And while I was checking out the page's source code, I saw some validation code they use to check email addresses.

[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,10}$

It has always been difficult to find a short enough and smart enough regex for validating emails.  I'll follow Google's lead and use this next time I need a quick check for a valid email.

No comments:

Post a Comment