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 <[email protected]>
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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to