4 ms·
The regex listed there isn’t that much more complex. It’s basically a check for *@a*.* where * is some minimal whitelist of valid characters and a is an alphanu
by ghayes 5y ago
The regex listed there isn’t that much more complex. It’s basically a check for *@a*.* where * is some minimal whitelist of valid characters and a is an alphanumeric to start the domain name.
- merlinscholz 5y agoAnd even though that sounds reasonable, it is still wrong. Technically, you do not even need the dot, if you add an MX record to a whole TLD or have some other funky DNS setup. Source: https://www.netmeister.org/blog/email.html https://www.netmeister.org/blog/email.html
- 0x640x6D 5y agoThe linked regexp doesn't require the TLD: https://rubular.com/r/Y9G4HR2Ox8gzqd https://rubular.com/r/Y9G4HR2Ox8gzqd
- NavinF 5y agoYep! I know that @mil addresses used to be a thing. With the explosion of new TLDs I would be unsurprised if name@gmail addresses became a thing in the future and silly devs handled it by adding an exception to their huge regex instead of just using “.+@.+”.
- ameliaquining 5y agoI'll quote the WHATWG HTML spec, which that Ruby code cites as its source (https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address https://html.spec.whatwg.org/multipage/input.html#valid-e-ma...): > This requirement is a willful violation of RFC 5322, which defines a syntax for email addresses that is simultaneously too strict (before the "@" character), too vague (after the "@" character), and too lax (allowing comments, whitespace characters, and quoted strings in manners unfamiliar to most users) to be of practical use here. Personally, I say if it's good enough for Web browsers, it's probably good enough for your app.