Mark S. Miller (2015-06-13T05:51:31.000Z)
Nice! Inspired

  // Based on
  // https://github.com/benjamingr/RexExp.escape/blob/master/polyfill.js
  function re(template, ...subs) {
    const parts = [];
    const numSubs = subs.length;
    for (let i = 0; i < numSubs; i++) {
      parts.push(template.raw[i]);
      parts.push(subs[i].replace(/[\/\\^$*+?.()|[\]{}]/g, '\\$&'));
    }
    parts.push(template.raw[numSubs]);
    return RegExp(parts.join(''));
  }



On Fri, Jun 12, 2015 at 5:48 PM, Benjamin Gruenbaum <benjamingr at gmail.com>
wrote:

> Ok, with a ton of help from Domenic I've put up
> http://benjamingr.github.io/RexExp.escape/
>
> Less cool coloring but more links and motivating examples and so on at
> https://github.com/benjamingr/RexExp.escape
>
> As this is my first attempt at this sort of thing - any non-bikeshed
> feedback would be appreciated :)
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150612/7b2ea268/attachment.html>
d at domenic.me (2015-06-16T16:53:17.970Z)
Nice! Inspired

```js
  // Based on
  // https://github.com/benjamingr/RexExp.escape/blob/master/polyfill.js
  function re(template, ...subs) {
    const parts = [];
    const numSubs = subs.length;
    for (let i = 0; i < numSubs; i++) {
      parts.push(template.raw[i]);
      parts.push(subs[i].replace(/[\/\\^$*+?.()|[\]{}]/g, '\\$&'));
    }
    parts.push(template.raw[numSubs]);
    return RegExp(parts.join(''));
  }
```