Thanks for your answer, then I'm looking forward to the meeting results.

- André



PS: Here's another difference, /^\0000$/ matches "\0" in SM, JSC and Opera, whereas in IE10 and V8 it matches "\u00000" (that's "\0" concat'ed with "0"). Per [2] it ought to be "\u00000".


On 3/16/2012 2:05 AM, Luke Hoban wrote:
Although not specified in ES5, octal escapes are required in regular expressions for web 
reality [1,2]. [1] even claims the extensions are "extensive and consistent across 
browsers". But for invalid octal escapes, the browsers are not consistent. For 
example:
/^\8$/ matches "\\8" in Spidermonkey, JSC and Opera, whereas in IE10 and V8, /^\8$/ 
matches "8".
/^\777$/ matches "\x3F7" in SM, JSC, Opera and V8, whereas in IE10, /^\777$/ matches 
"\u01FF".
Is there going to be any kind of consolidation for ES6?


Yes - the goal of [1] and [2] is to include normative optional text in Annex B 
of ES6 which nails down more of the behavior.  The spec text in [2] was an 
attempt to describe the shared common ground.  From your examples, it looks 
like there remain places where there are disagreements between browsers even in 
the limited extension this spec text aims to cover.

I'll put discussion of [2] on the agenda for the upcoming TC39 f2f meeting.

For reference - that candidate spec text gives the following behavior for your 
two examples:

/^\8$/ matches "8".  It is treated as an IdentityEscape because it is not a 
valid DecimalEscape or OctalEscapeSequence.

/^\777$/ matches "\x3F7".  It is treated as an OctalEscapeSequence followed by 
a 7.

Luke


[1] http://wiki.ecmascript.org/doku.php?id=harmony:regexp_match_web_reality
[2] http://wiki.ecmascript.org/doku.php?id=strawman:match_web_reality_spec


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to