Re:Formly: the form glamorizer for jQuery
by mixmax on Wednesday June 01, 2011 @05:22AM
(#2606603)
The e-mail regex needs some work - [email protected], which is a valid e-mail address, doesn't validate to true.
[ Parent
| on HN ]
Re:Formly: the form glamorizer for jQuery
by constant_change on Wednesday June 01, 2011 @07:48AM
(#2606851)
Sometimes it's best just not to bother with a regular expression. Email addresses are a prime example of where this is true.
This has been discussed to death all over the place, but I think the take home is not to be too clever rather than not to use regexes. I tend to look for 'something at something dot something':
.+@.+\..+
I believe this allows all valid addresses (as well as lots of invalid ones, obviously). But I'm sure someone will let us know if not. :)If you REALLY need to validate en email address:
http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
but again, only if you REALLY, REALLY , REALLY want to.
Re:Formly: the form glamorizer for jQuery
by pspeter3 on Wednesday June 01, 2011 @11:33AM
(#2607709)
That's ridiculous and awesome. I'm glad regular expressions exist so we can make garbage/magic like that
Re:Formly: the form glamorizer for jQuery
by pavel_lishin on Wednesday June 01, 2011 @05:50PM
(#2609518)
For a second, I thought it was a perl script.
Re:Formly: the form glamorizer for jQuery
by mquander on Wednesday June 01, 2011 @09:49AM
(#2607225)
Obvious counterexample: me@localhost. (Not that this is a useful counterexample in the context of a form submission.)
Re:Formly: the form glamorizer for jQuery
by lpolovets on Wednesday June 01, 2011 @11:38AM
(#2607743)
http://fightingforalostcause.net/misc/2006/compare-email-reg... is a good site that has a number of email regex variants and how well they do on various email address formats.