RegExp.escape

Jordan Harband ljharb at gmail.com
Fri Jun 12 18:38:55 UTC 2015


The primary advantage to making it be a function (also doing it as syntax
would be great too!) is that it's polyfillable, which means that all
browsers could instantly take advantage of known-safe regex escaping.

On Fri, Jun 12, 2015 at 11:34 AM, Alexander Jones <alex at weej.com> wrote:

> At risk of bikeshed, I think I would prefer syntax for it, personally,
> e.g.:
>
>     let myRegExp = /\d+\./{arbitrary.js(expression)}/SOMETHING$/;
>
> (ASI issues notwithstanding) vaguely matching the idea of template
> strings. I prefer this kind of thing to be structured at the parse-level
> rather than relying on runtime string stitching and hoping for a valid
> parse.
>
> Cheers
>
> On Friday, June 12, 2015, Benjamin Gruenaum <benjamingr at gmail.com> wrote:
>
>> Reviving this, a year passed and I think we still want this.
>>
>> We have even more validation than we had a year ago (added by libraries
>> like lodash) and this is still useful.
>>
>> What would be the required steps in order to push this forward to the
>> ES2016 spec?
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150612/b993ffd3/attachment.html>


More information about the es-discuss mailing list