4 ms·
That regular expression fails to validate a bunch of the examples from the article. And also single-word addresses, which are pretty useful if you want to rout
by biztos 5y ago
That regular expression fails to validate a bunch of the examples from the article. And also single-word addresses, which are pretty useful if you want to route email locally.
So what makes it the best?
[Edit: it also assumes you've already parsed out the "real" address from the rest of the text field, which to me makes it a half-validator at most.]
- crazygringo 5y agoYes, that's the explicit point of it. But it would seem to be the best for general-purpose web use, e.g. signing up for a newsletter with an e-mail address that's pretty much guaranteed not to break anything. Instead of being conservative in output, it's intentionally being conservative in input.
- chrismorgan 5y agoSingle-word addresses? I presume you main domain names with only one domain label (like “localhost”). Read the grammar again, they’re supported. > it also assumes you've already parsed out the "real" address from the rest of the text field, which to me makes it a half-validator at most I’m confused. The explicit purpose of this stuff is to validate an email address. Not to extract an email address from a freeform text field, which I think is what you’re talking about. Deciding how to do that is a whole ’nother can of worms.
- toomanybeersies 5y ago> And also single-word addresses, which are pretty useful if you want to route email locally Unless you're developing an app for an intranet, that's not a concern for most people.