/\1/ could be a valid RegExp through Chapter 16 Extension clause?

Lasse Reichstein reichsteinatwork at gmail.com
Thu Jul 7 00:39:42 PDT 2011

On Thu, Jul 7, 2011 at 3:52 AM, Mike Samuel <mikesamuel at gmail.com> wrote:

> Yes, by the extension, and whether a \<octal> is a backreference or an
> octal escape sequence is determined by whether there are
> parseInt(<octal>, 10) capturing groups to the left of it in the
> regular expression.
> So
>    /\1(foo)\1/
> matches the same language as
>   /\u0001(foo)\1/

I don't think thats correct.
The \1 is a valid DecimalEscape, its value is 1, which is not greater than
NCapturingParens in step 7 (NCapturingParens is defined globally
for the pattern, not just to the left of the current escape). I.e., it is
not a Syntax Error, so the \1 must be treated as a back-reference. It will
always be to a non-participating capture, so the regexp is equivalent to
or just
but never to

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110707/106b634a/attachment.html>

More information about the es-discuss mailing list