Invalid Octal Escapes in Regular Expressions

André Bargull andre.bargull at udo.edu
Thu Mar 15 03:30:48 PDT 2012


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?

Thanks,
André


[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



More information about the es-discuss mailing list