HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
6884Add a note about how to implement type=email checking with a regular expression.2012-01-10 00:56
@@ -51630,20 +51630,36 @@ interface <dfn>HTMLFormElement</dfn> : <span>HTMLElement</span> {
   href="#refsRFC1034">[RFC1034]</a></p> <!-- Domain syntax based on
   section 3.5 of [RFC1034] and section 2.1 of [RFC1123] -->
 
   <p class="note">This requirement is a <span>willful violation</span>
   of RFC 5322, which defines a syntax for e-mail addresses that is
   simultaneously too strict (before the "@" character), too vague
   (after the "@" character), and too lax (allowing comments,
   whitespace characters, and quoted strings in manners unfamiliar to
   most users) to be of practical use here.</p>
 
+  <div class="note">
+
+   <!--END dev-html--><!--<p><i>This note, like all notes, is
+   non-normative. In case of a conflict between this note and the
+   above definition, the above definition takes precedence. Please
+   report any such inconsistencies!</i></p>--><!--START dev-html-->
+
+   <p>The following JavaScript- and Perl-compatible regular expression
+   is an implementation of the above definition.</p>
+
+   <pre>/^[a-zA-Z0-9.!#$%&amp;'*+-/=?\^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/</pre>
+
+   <!-- based on: http://blog.gerv.net/2011/05/html5_email_address_regexp/ -->
+
+  </div>
+
   <p>A <dfn>valid e-mail address list</dfn> is a <span>set of
   comma-separated tokens</span>, where each token is itself a
   <span>valid e-mail address</span>. <span class="impl">To obtain the
   list of tokens from a <span>valid e-mail address list</span>, and
   implementation must <span title="split a string on commas">split the
   string on commas</span>.</span></p>
 
   <div class="bookkeeping">
 
    <p>The following common <code>input</code> element content

|