<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15904</bug_id>
          
          <creation_ts>2012-02-05 18:17:47 +0000</creation_ts>
          <short_desc>pattern attribute does not clarify the reserved characters, nor the escape character, if any</short_desc>
          <delta_ts>2012-05-08 00:13:37 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#top</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>dave</cc>
    
    <cc>ian</cc>
    
    <cc>lrosenth</cc>
    
    <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>sun</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>63722</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2012-02-05 18:17:47 +0000</bug_when>
    <thetext>Specification: http://dev.w3.org/html5/spec/Overview.html
Multipage: http://www.whatwg.org/C#top
Complete: http://www.whatwg.org/c#top

Comment:
On: The pattern attribute (forms)

The spec does not clarify what the reserved characters of the regular
expressions are, and what the escape character is, nor whether there is any.

The pattern attribute value example (&quot;[0-9][A-Z]{3}&quot;) is a trivial one.

But what if the pattern value contains a forward-slash?

Is it:	  &lt;input pattern=&quot;[0-9]/[A-Z]{3}&quot; name=&quot;part&quot; /&gt;

Or is it: &lt;input pattern=&quot;[0-9]\/[A-Z]{3}&quot; name=&quot;part&quot; /&gt;

Are user agents supposed to escape reserved characters in the expression
before compiling it?  And if so, how can that work reliably across
implementations?

As the pattern also needs to be validated on the server-side, and the
server-side also uses regular expressions, the same question exists there.  It
actually turns into a problem, as it&apos;s not clear who&apos;s responsible for
escaping characters in the regular expression, and which reserved characters,
if any, actually need to be escaped.

Reply-To: sun@unleashedmind.com
Cause: http://drupal.org/node/1174766


Posted from: 91.19.60.83
User agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64884</commentid>
    <comment_count>1</comment_count>
    <who name="Dave Reid">dave</who>
    <bug_when>2012-03-02 05:51:18 +0000</bug_when>
    <thetext>I would greatly prefer that the spec be modified to assume that the pattern must be formatted in PRCE format since that seems to be the most universally supported syntax for regex patterns. I know that Google Chrome is fine having escaped characters, so I would really prefer this to be defined in the specification.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64892</commentid>
    <comment_count>2</comment_count>
    <who name="sun">sun</who>
    <bug_when>2012-03-02 10:19:27 +0000</bug_when>
    <thetext>Further debugging by Dave Reid revealed that

    &lt;input type=&quot;text&quot; pattern=&quot;[0-9]/[0-9]&quot; /&gt;

matches the string &apos;0/0&apos; even though the forward slash is not escaped.  However,

    &lt;input type=&quot;text&quot; pattern=&quot;[0-9]\/[0-9]&quot; /&gt;

*also* succeeds to match the string &apos;0/0&apos;.  Hence, &apos;/&apos; does not seem to be the regular expression&apos;s delimiter (in some browser implementations).

Testing this on

http://html5pattern.com/#t=Expression%20delimiter&amp;a=sun&amp;d=1/1/1/1.1%5B1%5D1%5C%20and%201/1/121.1%5B1%5D1%5C%20might%20pass.%20The%20escape%20character%20seems%20to%20be%20%5C%2C%20but%20/%20is%20not%20the%20regex%20delimiter.%20What%27s%20the%20delimiter%3F&amp;ta=&amp;p=1/1%5C/1.1%5C.1%5C%5B1%5C%5D1%5C%5C

seems to confirm that &apos;/&apos; is not the reserved expression delimiter.  It also seems to confirm that &apos;\&apos; is the escape character.

So the problem remains to be that we need to know what the expression delimiter is, in order to actually perform and ensure proper escaping of that character in the regular expression.

See: http://stackoverflow.com/questions/9526814/what-is-a-safe-pcre-regex-delimiter-to-use-on-html5-pattern-input-element-attrib</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67444</commentid>
    <comment_count>3</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-05-08 00:13:37 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Rejected
Change Description: no spec change
Rationale: As far as I can tell this is already defined. The spec says &quot;the attribute&apos;s value must match the JavaScript Pattern production&quot;. So it&apos;s up to the JS spec.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>