Re:Is it a must for every programmer to learn regular expres...
by Auguste on Thursday August 16, 2012 @04:45AM
(#4390465)
I find that perfectly readable, except for the \b which I hadn't seen before. It's matching an all-uppercase email address.
[ Parent
| on HN ]
Re:Is it a must for every programmer to learn regular expres...
by subsystem on Thursday August 16, 2012 @04:50AM
(#4390481)
There's plenty of upper case e-mail addresses that won't match that expression.
Re:Is it a must for every programmer to learn regular expres...
by aidos on Thursday August 16, 2012 @05:08AM
(#4390521)
Well, if you want to be fully compliant you can go for this 6kb monster
Re:Is it a must for every programmer to learn regular expres...
by InclinedPlane on Thursday August 16, 2012 @04:52AM
(#4390489)
/i
Re:Is it a must for every programmer to learn regular expres...
by subsystem on Thursday August 16, 2012 @05:09AM
(#4390523)
There's characters missing[1] and the tld is too short[2]. And even if that's fixed, we still don't match internationalized addresses or actually validate that the e-mail address exists. You're probably better off with something like...
if "@" in email and "." in email.split("@")[1]:
send_verification(email)
...but you should probably also check for common misspellings like "gmial.com" etc.[1] http://en.wikipedia.org/wiki/Email_address#Syntax [2] http://en.wikipedia.org/wiki/List_of_Internet_top-level_doma...