RegExp.escape()

David Herman dherman at mozilla.com
Fri Jun 15 12:13:07 PDT 2012


On Mar 23, 2012, at 8:16 AM, Steven Levithan wrote:

> Although this is only a minor convenience since you can do something like text.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&"), the list of special characters is subject to change.

That sounds like another good argument for standardizing.

The only challenge I see is how to fudge the spec enough to mandate that any extended, non-standard operators that the engine provides should also be escaped.

Dave



More information about the es-discuss mailing list