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

Brendan Eich brendan at
Thu Sep 13 21:43:11 PDT 2007

I am not looking to make trouble here, believe me, but I want to  
point out two things that could help David's case:

1. JS regexps were modeled by me (to lwall's horror ;-) on Perl  
regexen. Here's what perl (5.8.8) does:

$ perl
"aaab" =~ /(a\1)+|b/;
print "$& ($1)\n";
b ()

It's no surprise JavaScriptCore agrees, since it is based on PCRE.  
Tamarin is too -- do you know what it does?

2. IE JScript does not agree with any of Perl/JavaScriptCore or ES3  
and conformant implementations. That does not mean it should prevail  
for this edge case. But it does suggest we could change to match  
Perl, and match David's two-person (three counting him; perhaps four  
if I count ;-) developer sample.


More information about the Es4-discuss mailing list