read

Quick links: Source code | Email address validators head-to-head

I’ve discovered a number of other public-domain functions that attempt to validate the format of an email address. I tried to validate my 124 test cases against these functions with the results below:

Dominic Sayers: 100% correctly validated Simon Slick: 88%  Dave Child: 80% Cal Henderson: 72%

Interestingly, all the other functions failed correctly to validate the example addresses given in RFC3696 (Section 3: Restrictions on email addresses).

I couldn’t include Doug Lovell’s function in my tests because the code is copyright All Rights Reserved by Linux Journal (ironically).

Some of the other functions also supply test cases; I’ve added these to my test suite. More analysis and commentary here: RFC-compliant email address validator.

In summary, I recommend you use my function if you want totally RFC-compliant address validation.

Quick links: Source code | Email address validators head-to-head