4 ms·
For most purposes, if you're trying to use parsing to achieve email address validation perfection, you've already lost the battle. A valid email address typica
by mumblemumble 6y ago
For most purposes, if you're trying to use parsing to achieve email address validation perfection, you've already lost the battle.
A valid email address typically isn't just a syntactically correct one; it's also one that can be used to get an email to the recipient. The only way to test that is to send an email and see if it gets to the recipient. Which is why it's much more common to see some minimal client-side validation that uses a simple regex that will (ideally) match all valid email addresses but only catch gross syntactic errors like typing # where you meant @, more for the sake of decent UX than anything else, and rely on asking the user to double-type their email address and sending an activation email to deal with finger-grained syntactic errors and the whole universe of non-syntactic errors.
- indymike 6y ago# is a valid character in an email address. Regexes are a horrible idea to validate or parse emails and have been since the beginning. Most regexes will be too strict. The reason people use regexes on the client side is they copy pasta something they find on the internet. Incidentally, a great way to get emails delivered is to properly validate them. Sure typos are possible... Few things are a worse user experience than having a valid email rejected by a client side parser.