4 ms·
Email address specs turn out to be rather complicated. I really wish people wouldn't code their own checks rather than use already existing standards. Some la
by Twirrim 2y ago
Email address specs turn out to be rather complicated.
I really wish people wouldn't code their own checks rather than use already existing standards. Some languages like Java even include proper checks in their standard library: https://java.net/projects/javamail https://java.net/projects/javamail
Several jobs back I had no end of arguments with some Java devs about not writing their own checks, that kept routinely failing on legitimate addresses.
- smrtinsert 2y agoIt's all devs in general. As a java dev I have lost count of the number of times I have to tell any dev not to use a damn regex to validate emails.
- soco 2y agoBut why do you even need to validate that email? Send the subscriber a confirmation link - if they get it then it was valid, if not then it's on them to fix the situation in whatever way they find fit.
- _yb2s 2y agoA single massive and unreadable regex isn't an appropriate way to validate a spec that complex. With its complexity it can't be logically evaluated- only tested, whereas a function that breaks the spec out into steps/parts is going to be a lot more maintainable, readable, and auditable.