code: function getRegex(str) {
    var s = str.split('').map(function(v) {
      //escape special chars
      if (
          '*'  === v   ||
          '.'  === v   ||
          '+'  === v   ||
          '('  === v   ||
          ')'  === v   ||
          '\\' === v   ||
          '?'  === v   ||
          '\'' === v   ||
          '$'  === v   ||
          '^'  === v   ||
          '/'  === v   ||
          '['  === v   ||
          ']'  === v
        ) v = '\\' + v;
  
      return '(' + v + ')';
    });
    s = '^(.*?)' + s.join('(.*?)') + '(.*?)(.*)$';
    return new RegExp(s, 'i');
  }
docs: /*
  getRegex :: String -> RegExp
   
  Returns a regular expression that is used by the
  subsequence search engine.
  @param  {String} str String to search for
  @return {RegExp}     Regular expression based off input search string