5 ms·
Email validation is indeed a complex and occasionally surprising beast. Clearly this regex is impractical, but any validation you invent yourself is likely inc
by fuzzix 14y ago
Email validation is indeed a complex and occasionally surprising beast.
Clearly this regex is impractical, but any validation you invent yourself is likely incorrect. The best way to validate email addresses remains sending an email to them.
- rmccue 14y ago+1, seeing as you're probably going to be sending an activation email anyway. You can do some practical checks, like checking that there's a '@' in the email, and probably trimming spaces (I think leading/trailing whitespace isn't allowed, from memory).
- HyprMusic 14y agoIn RFC822 spaces are actually allowed, I think they just have to be in a quoted string.
- regularfry 14y agoIs it impractical, though? It's already been written, and I've not seen any suggestion that it's not correct (other than the problem with comments, but that's intrinsic to regexes in general). As long as you're going to follow up by actually sending an email, I don't see a problem with this as a first-pass filter.