RegExps that don't modify global state?
C. Scott Ananian
ecmascript at cscott.net
Wed Sep 17 08:56:41 PDT 2014
On Wed, Sep 17, 2014 at 11:39 AM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
> Annex B contains many changes to RegExp from the base standard. Perhaps a better way to approach this is to have a standard (not Annex B) regexp flag (perhaps 's', for "standard" or "strict") that means that this regexp should be strictly applied using only the ES standard semantics without any Annex B or other extensions.
`s` is already in use in the wider regex world, of course. The perl
precedent seems to be to use `d` for this -- it originally meant
"Default" as in, "default semantics pre-perl 5.14", but was soon
nicknamed "dodgy" or "d@!#". Seems like a good model to follow.
Not sure we can get away with making this opt-in, though. It would be
nice if we could.
More information about the es-discuss