Skip to content

Email validation head-to-head

by Dominic on February 10th, 2009

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

3 Comments
  1. I had a nice reply from Dave Child, pointing out that he was right and I was wrong about one of his test cases :-)

    I have corrected the page on my web site.

  2. Another message, this time from Cal Henderson, making much the same point as Dave Child.

    Thanks for the input, chaps.

  3. I’ve updated my page and the tests to v0.8 based on the responses from Dave Childs and Cal Handerson, and further input from Phil Haack.

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS