3 ms·
The problem is that the actual spec for validating email addresses is preposterously long and complex, and can't even be implemented as a regexp since it requir
by tlb 17y ago
The problem is that the actual spec for validating email addresses is preposterously long and complex, and can't even be implemented as a regexp since it requires nested parsing. So everyone just writes /^\w+@\w+\.[\.\w]+$/ or something lame.
- ominous_prime 17y agoNo, the problem is people trying to validate email addresses when they shouldn't. Similar to the credit card name example in TFA, you're trying to save a call to the MTA, when in reality, a user that doesn't want to be contacted will enter foo@foo.com, and you have to send it anyway.
- bruceboughton 17y agoNo, the problem is people trying to validate email addresses.
- blasdel 17y agoThe 'spec' for validating an email address is to send mail containing a token to it and require the user to respond with it. Bang paths are valid but aren't going to be routable these days. Different hosts allow different characters in usernames, and have different meta-replacement rules for stuff like periods and pluses. You don't validate a domain name with a regex, you use a goddamn DNS resolver. Email addresses are a superset of that! Don't use a fucking regex.