Proposal for exact matching and matching at a position in RegExp

Andy Chu andy at
Mon Feb 22 21:54:05 PST 2010

> Not clear, since ES3 deviated from Perl and will not reconverge. The
> committee is not going to standardize any lastIndex or pos mapping per
> target string and regex pair, I am pretty sure.

I'm glad we're not following Perl to Perl 5 regexps.

Not clear on the "pos per pair" statement.  All that I'm proposing is
the following logic for .exec() and .test():

First try the parameter pos to find the start position.
If pos is unspecified, use the .lastIndex member of the RegExp instance.
If both are undefined, use 0.

The only thing different is the first line.  Is there something wrong with that?

> Anyway, when adding /y, we reckoned it was better to keep being different
> than to try \G and invite complaints that we weren't the same as the
> "genetic parent", Perl. Mutation is a bitch, and we're quite the red-headed
> stepchild now ;-).

Even Perl 6 has let go of Perl 5 regexps, so I don't think anyone will
complain.  I definitely won't.


More information about the es-discuss mailing list