Categories
Blog

Comparing E-mail Address Validating Regular Expressions #code

I wanted to find a regular expression to validate e-mail addresses, but when I searched I found dozens of slightly different versions of the same expression. Almost all of them had people leaving comments about how it failed to validate or invalidate some rare but completely valid/invalid address syntax. But dispite all the criticism, I couldn’t find a definitive “best” expression. So, I setup arrays of some of the most promising expressions as well as a (hopefully) complete sampling of valid and invalid addresses. It’s my philosophy that it’s better to accept a few invalid addresses than reject any valid ones, so I’m shooting for 0 false-positives and as few false-negatives as possible.

[..]