function getValidRegex(pattern) {
  var escaped = (0, _escapeRegexp2.default)(pattern);

  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = filters[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var data = _step.value;

      var rxp = new RegExp("\\\\\\[" + data[0] + "\\\\:[A-Za-z]{0,}?\\\\]", "g");

      if (rxp.exec(escaped)) {
        escaped = escaped.replace(rxp, data[1]);
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  return new RegExp("^" + escaped + "$", "g");
}
function getValidRegex(pattern) {
  var escaped = (0, _escapeRegexp2.default)(pattern);

  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = filters[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var data = _step.value;

      var rxp = new RegExp("\\\\\\[" + data[0] + "\\\\:[A-Za-z]{0,}?\\\\]", "g");

      if (rxp.exec(escaped)) {
        escaped = escaped.replace(rxp, data[1]);
      }
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  return new RegExp("^" + escaped + "$", "g");
}
function getValidRegex ( pattern ) { var escaped = ( 0 , _escapeRegexp2 . default ) ( pattern ) ; var _iteratorNormalCompletion = true ; var _didIteratorError = false ; var _iteratorError = undefined ; try { for ( var _iterator = filters [ Symbol . iterator ] ( ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) { var data = _step . value ; var rxp = new RegExp ( "\\\\\\[" + data [ 0 ] + "\\\\:[A-Za-z]{0,}?\\\\]" , "g" ) ; if ( rxp . exec ( escaped ) ) { escaped = escaped . replace ( rxp , data [ 1 ] ) ; } } } catch ( err ) { _didIteratorError = true ; _iteratorError = err ; } finally { try { if ( ! _iteratorNormalCompletion && _iterator . return ) { _iterator . return ( ) ; } } finally { if ( _didIteratorError ) { throw _iteratorError ; } } } return new RegExp ( "^" + escaped + "$" , "g" ) ; }
Return a valid, escaped regular expression from a `pattern`. A pattern should
respect the following structure: `[filter:name?]`.

@param   {string}    pattern   Pattern to convert
@return  {RegExp}              Escaped regular expression
Return a valid escaped regular expression from a pattern . A pattern should respect the following structure : [ filter : name? ] .