Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
All you need for validating emails (regexlib.com)
2 points by khangtoh on March 10, 2009 | hide | past | favorite | 3 comments


This is much more complex than it looks. I'd trust either of these before I trust those simpleton attempts, but it looks like some of them may be complete. Too hard to read the site for the longer ones though to actually find out (why is the regular expression in a little 2 line scrollable area? And why are they are not encouraging the use of extended syntax that can be commented?)

http://www.regular-expressions.info/email.html http://search.cpan.org/~rjbs/Email-Address-1.889/lib/Email/A...


As I've argued everywhere I see this sort of thing, this does not validate email addresses.

If I don't want you to have my email address, you'll get n.o.thanks@microsoft.com and that will fly through any shape validation, domain validation, character checks, any regex you can think of.

It still wont be my email address. If people aren't giving you valid email addresses, reassess your site and consider why instead of throwing technology at the alleged problem.


The point is not to check whether or not n.o.thanks@microsoft.com is your address, but that it follows valid syntax. Users make mistakes - I just watched a customer this morning type name@domaincom instead of name@domain.com when entering his address. I've even seen users enter their names instead of email addresses when prompted for an email address. This happens all too often and can make database management a hassle. Checking the syntax first can make life a little easier for the DB guys.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: