There's got to be a bug because this was on the front page 6 days ago: http://news.ycombinator.com/item?id=4486108 Well the link in the previous post had a trailing slash.
Funny part is that this submission made it to the front page again... I guess this is a really popular topic?
Stop Validating Email Addresses With Your Complex Regexes
11–20 of 25 posts
Re: Stop Validating Email Addresses With Your Complex Regexes
#12I just check if there's a @
Re: Stop Validating Email Addresses With Your Complex Regexes
#13There's got to be a bug because this was on the front page 6 days ago: http://news.ycombinator.com/item?id=4486108 Well the link in the previous post had a trailing slash.
1) Someone did make a fully compliant Regex https://github.com/larb/email_address_validator
2) Lots of people (including the author http://news.ycombinator.com/item?id=4486264) think that you should at least validate that the '@' is somewhere to avoid username / email mixups
3) If your regex fails for foo+tag@something.com lots of people get pissed. I learned you can use that for inbox sorting since foo+tag@something.com goes to foo@something.com.
4) There are other schools of thought that promote validation and telling the user something is wrong like mailcheck.js (https://github.com/Kicksend/mailcheck), but these should not stop users from submitting forms.
Did I miss anything?
Re: Stop Validating Email Addresses With Your Complex Regexes
#14If you've been developing login systems for any length of time, this should be fairly obvious. Be careful about taking that "it’ll get bounced" attitude too far though. The last time I did so I forgot to trim the email addresses and didn't lowercase them. Failing to trim will probably result in the email going through, but then might cause problems later on when you try to match their login ID to what they enter the…
Re: Stop Validating Email Addresses With Your Complex Regexes
#15If you've been developing login systems for any length of time, this should be fairly obvious. Be careful about taking that "it’ll get bounced" attitude too far though. The last time I did so I forgot to trim the email addresses and didn't lowercase them. Failing to trim will probably result in the email going through, but then might cause problems later on when you try to match their login ID to what they enter the…
Regarding upper case: I've taken to typing the first part of my work email address as "JensenS". My wife and I work at the same place, and when I wrote it as "jensens" there were honestly people who assumed that address was a plural and went to both of us.
facepalm
Re: Stop Validating Email Addresses With Your Complex Regexes
#16beware: yahoo's smtp servers always say addresses are valid...making validation quite pointless.
Re: Stop Validating Email Addresses With Your Complex Regexes
#17Re: Stop Validating Email Addresses With Your Complex Regexes
#18I couldn't help thinking while reading this that my main concern with registration systems isn't the complicated Regex as much, but rather the really annoying registry bots that sign up phantom accounts. I'm not a huge Captcha fan, but without something (Recaptcha, ghosted fields, etc) you'll get SPAMMED with tons of fake accounts - and they have valid emails, AND the bots click on the links in the confirmation email…
Re: Stop Validating Email Addresses With Your Complex Regexes
#19What about just checking if a MX record exists?
One possibility would be to lookup the MX, then connect to the remote MTA and ask it directly if the mailbox is valid. But that seems a bit like over-engineering.
Re: Stop Validating Email Addresses With Your Complex Regexes
#20I couldn't help thinking while reading this that my main concern with registration systems isn't the complicated Regex as much, but rather the really annoying registry bots that sign up phantom accounts. I'm not a huge Captcha fan, but without something (Recaptcha, ghosted fields, etc) you'll get SPAMMED with tons of fake accounts - and they have valid emails, AND the bots click on the links in the confirmation email…