Regex: How should backreferences contained in the capturing match they reference to work?

liorean liorean at
Fri Sep 14 13:19:50 PDT 2007

On 14/09/2007, Brendan Eich <brendan at> wrote:
> "Almost all" excludes IE JScript, right?

Well, it doesn't agree with me on what is the right approach, but it
does agree with me that the ES3 approach is wrong.

> Those implementations are
> JavaScriptCore, based on PCRE, and what else?

The only implementations that I know of that specifically implement
the ES3 algorithms are those in SpiderMonkey, linear_b and futhark (I
have no idea about SEE, Rhino, and a lot of other fringe JS engines
however). And the ES4 refimpl I guess.

I only said "almost all" because I haven't tested each and every one.
It could be possible that the only ones behaving according to the ES3
algorithm *at all* are indeed those written to match the ES3
algorithms. It's also possible that there are those that do match the
ES3 algorithms but are not written specifically for them - I just
don't know of any such implementation.

JavaScriptCore uses PCRE, so of course it's not written specifically
for the ES3 algorithms.

The JScript one is shared with at least VBScript, and I wouldn't be
surprised if it was shared with VB, VBA and other COM environments as
well. I don't think it's written specifically for the ES3 algorithms.
It's peculiar, and I think it doesn't agree with anybody else on a few
edge cases besides those I've brought up.

> Again, it's the Perl connection.

Not only. Both Perl and those POSIX flavour regex that implement
capturing submatches...
David "liorean" Andersson

More information about the Es4-discuss mailing list