4 ms·
This is really cool! 2 points: 1. it fiddled with my back button which is a bit annoying 2. a better email sample is ^[^@]+@[^@]+\.[^@]+$ which remove
by kitd 7y ago
This is really cool!
2 points:
1. it fiddled with my back button which is a bit annoying
2. a better email sample is
^[^@]+@[^@]+\.[^@]+$
which removes the 2 ampersands problem.
- geongeorgek 7y agoThank you! I think I know what's wrong with your back button. I will fix it. And for the regex. will try it out and see if I can add it.
- skrebbel 7y agoYou'll probably want to add \S to those character classes as well, or it matches "it's an @ sign. not an ampersand."
- anamexis 7y agoEscaped or quoted whitespace is allowed in the local part of email addresses.
- laumars 7y agoEven that is wrong because you can have privately owned TLDs (I forget what they're technically called) like .google So sundar.pichai@google is technically a valid address (whether .google has any MX records is another matter) Regex shouldn't really be used for email addresses anyway because the only reliable way to authenticate an email address is to literally send an email to that address.
- donalhunt 7y ago.google does not have any MX records
- laumars 7y agoNo, but theoretically it could.
- bduerst 7y agoAFAIK none of the TLDs allow for MX records on just the TLD i.e. johndoe@com will never exist
- bradbeattie 7y agoWhat about things like root@localhost?
- laumars 7y agoI'm not on about gTLDs like .com, I'm on about the privately owned ones like .amazon and .google
- bmn__ 7y agoThat's not how the spec works. Compliant solution: https://stackoverflow.com/a/1917982 https://stackoverflow.com/a/1917982