Hacker News new | ask | show | jobs
by ColMustard 5246 days ago
More like you shouldn't validate emails by using crappy regular expressions?

AFAIK there are regular expressions that cover all valid email addresses (and some invalid, but better than not recognizing one that is valid).

Although it gets pretty nasty: http://www.diablotin.com/librairie/autres/mre/chBB.html

1 comments

But since nearly every character is valid in an email address before the @ sign (within ""), it's much easier to validate `*@thisisavaliddomain.com` and just try sending an email. The way we do it, if the user enters an email that matches our reasonably comprehensive regexp we consider it valid, if it doesn't match we send the user an email and get them to verify it with a link, that way most users don't have to go through an annoying click-and-confirm email validation but we can still catch a few edge cases of people mistyping