JSFiddle - React, Tailwind, and code Playground

by John Schulz

JavaScript

RegExp.escape = (function() 
{
  var escape_chars = '/.*+?|()[]{}\\'.split(''),
      escaped_str  = '(\\' + specials.join('|\\') + ')', 'g',
      escaped_rgx  = new RegExp( escaped_str );

  return function(text) {
      return text.replace(escaped_rgx, '\\$1');
  }

})();