joomla/joomla-platform — pull request #1694 by elinw (2012-11-12 20:55:46+00:00)
Title: Update email validation to HTML5 standard and to allow longer top level domains

The email validation that we are currently using in JFormRule and also in javascript does not match the standard published by the W3C at http://www.w3.org/TR/html-markup/input.email.html. The validation rule also does not support the multiple attribute.

This pull request updates the regular expression to the W3C published standard. This is a less strict but more accurate standard than the current one used since it allows for email addresses that do not have top level domains. At the same time, many developers may desire to require a top level domain so this pull request also includes the option to require that along with a separate regular expression to match that. Unlike the older version this one only requires a minimum of two characters with no maximum (previously 4 was the maximum). The proliferation of top level domains makes it difficult to accurately set a maximum.

The HTML5 standard also includes a multiple attribute which can have a comma separated list of emails. This pull request also implements that. The multiple attribute may not be used in combination with the unique attribute.