RegExp.escape()

Benjamin Gruenbaum benjamingr at gmail.com
Tue Jun 30 07:46:22 UTC 2015


I'm still not sure if it's worth it, after all it's just sugar for
`RegExp.escape(str).replace(/[a-z]/gu, m => `\\${m}`)`

On Tue, Jun 30, 2015 at 10:35 AM, Mathias Bynens <mathiasb at opera.com> wrote:

> On Mon, Jun 29, 2015 at 9:04 PM, Benjamin Gruenbaum
> <benjamingr at gmail.com> wrote:
> > Why? What advantage would it offer?
>
> See Scott’s previous email:
>
> On Mon, Jun 29, 2015 at 8:42 PM, C. Scott Ananian <ecmascript at cscott.net>
> wrote:
> > Imagine trying to ensure that any characters over \u007f were
> > escaped.  You don't want an iterable over ~64k characters.
> >
> > In addition, a RegExp would allow you to concisely specify "hex digits,
> but
> > only at the start of the string" and some of the other oddities we've
> > considered.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150630/32780a56/attachment.html>


More information about the es-discuss mailing list