HTML5 E-Mail Validation

Validating email addresses is a very unthankful business. Whatever you do, you’re doing it wrong. If you follow the spec, users complain about false positives, if you don’t, they’ll complain about false negatives. And you can’t even blame them – in most contexts, “foo@bar” is not a valid address, according to the standard it is (consider “foo@localhost”).

As usual, being pragmatic and having a good testsuite helps. As part of the jQuery Validation plugin, a somewhat comprehensive testsuite came together. The implementation for that is here. That expression wasn’t written by hand, but compiled. Scott González has the tools for that.

With that in mind, what are the html5 email validations doing? While I don’t know what they’re testing against, Schalk Neethling looked up the implementations for Chrome and Firefox. It would be interesting to run those implementations against the testsuite above, and see if there are problems. Anyone interested in helping with that?