Create a regular expression based on the given `prefix`.
@param  {String} `prefix`
@return {RegExp}
550547
function toRegex(prefix) {
  var key = appendPrefix(prefix, '(\\d+)');
  if (cache.hasOwnProperty(key)) {
    return cache[key];
  }
  var regex = new RegExp(createRegexString(key), 'g');
  cache[key] = regex;
  return regex;
}
429772
function grep(s) {
  return new RegExp(_.map(str(s).split(/\s/), _.escapeRegExp).join('.*'), 'i');
}
970499
function match(regexp) {
        var O = requireObjectCoercible(this);
        var matcher = regexp == undefined ? undefined : regexp[MATCH];
        return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
      }
306376
function buildRegex(pattern) {
    var re = pattern
      .replace(escapeRegex, '\\$&')
      .replace(namedParam, '([^/]*)')
      .replace(splatParam, '(.*?)');

    return new RegExp('^' + re + '$');
  }
874788
function cloneRegExp(input) {
    'use strict';
    var pattern = input.source;
    var flags = '';
    if (input.global) {
        flags += 'g';
    }
    if (input.ignoreCase) {
        flags += 'i';
    }
    if (input.multiline) {
        flags += 'm';
    }
    return (new RegExp(pattern, flags));
}
590633
function make_regex(tokens) {
	var str = tokens.reduce(function (res, token, index) {
			var is_last = (index == (tokens.length - 1));
			var before_multi = (index === (tokens.length - 2)) && (last(tokens).type == "multi");
			return res + ((is_last || before_multi) ? token.last : token.piece);
		},
		"");
	return new RegExp("^" + str + "$");
}
240892
function stringToRegexp(str, keys, options = {}) {
  let tokens = parse(str, options);
  let end = options.end !== false;
  let strict = options.strict;
  let delimiter = options.delimiter ? escapeString(options.delimiter) : '\\/';
  let delimiters = options.delimiters || './';
  let endsWith = [].concat(options.endsWith || []).map(escapeString).concat('$').join('|');
  let isEndDelimited = false;
  let route = '';

  // Iterate over the tokens and create our regexp string.
  for (let i = 0; i < tokens.length; i++) {
    let token = tokens[i];

    if (typeof token === 'string') {
      route += escapeString(token);
      isEndDelimited = i === tokens.length - 1 && delimiters.includes(token[token.length - 1]);
      continue;
    }

    let prefix = escapeString(token.prefix);
    let capture = token.repeat
      ? `(?:${token.pattern})(?:${prefix}(?:${token.pattern}))*`
      : token.pattern;

    if (keys) keys.push(token);

    if (token.optional) {
      if (token.partial) {
        route += prefix + `(${capture})?`;
      } else {
        route += `(?:${prefix}(${capture}))?`;
      }
    } else {
      route += `${prefix}(${capture})`;
    }
  }

  if (end) {
    if (!strict) route += `(?:${delimiter})?`;

    route += endsWith === '$' ? '$' : `(?=${endsWith})`;
  } else {
    if (!strict) route += `(?:${delimiter}(?=${endsWith}))?`;
    if (!isEndDelimited) route += `(?=${delimiter}|${endsWith})`;
  }

  return `^${route}`;
}
971694
private String noprefix(String name, String... prefix) {
        for (int i = 0; i < prefix.length; i++) {
            if (name.startsWith(prefix[i])) {
                name = name.replaceAll(prefix[i], "");
            }
        }
        return name;
    }
299460
public function setPrefix($prefix)
    {
        // We ensure that the prefix is properly formatted. It
        // must start with a '/' and end without one.
        if($prefix != "") {
            if($prefix[0] != '/') {
                $prefix = '/' . $prefix;
            }
            if($prefix[strlen($prefix) - 1] == '/') {
                $prefix = substr($prefix, 0, strlen($prefix) - 1);
            }
        }

        $this->prefix = $prefix;
        return $this;
    }
990339
private Pattern makePattern(String noProxy) {
        String regex = noProxy.replaceAll("\\.", "\\\\.").replaceAll("\\*", ".*");
        if (!regex.startsWith(".*")) {
            regex = ".*" + regex;
        }
        regex = "^" + regex + "$";
        return Pattern.compile(regex);
    }
467558
function getShorthandName(fullname, prefix) {
    if (fullname[0] === "@") {
        let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname);

        if (matchResult) {
            return matchResult[1];
        }

        matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname);
        if (matchResult) {
            return `${matchResult[1]}/${matchResult[2]}`;
        }
    } else if (fullname.startsWith(`${prefix}-`)) {
        return fullname.slice(prefix.length + 1);
    }

    return fullname;
}
718215
function hasPrefix(text, prefix) {
  let exp = new RegExp(`^${prefix.pattern}`);
  let result = exp.test(text);

  if (prefix.antipattern) {
    let exp = new RegExp(`^${prefix.antipattern}`);
    result = result && !exp.test(text);
  }

  return result;
}
168805
function(string){
				var pattern = /(^|\W)(\w)(\w*)/g,
					result = [],
					match;
				
				while (pattern.exec(string)) {
					result.push(RegExp.$1 + RegExp.$2.toUpperCase() + RegExp.$3);
				}
				
				return result.join('');
			}
1211226
function(prefix) {
      do prefix += Math.floor(Math.random() * 1000000);
      while (document.getElementById(prefix));
      return prefix;
    }
1272517
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');
}
629514
function(route) {
      route = route.replace(escapeRegExp, '\\$&')
                   .replace(optionalParam, '(?:$1)?')
                   .replace(namedParam, '([^\/]+)')
                   .replace(splatParam, '(.*?)');
      return new RegExp('^' + route + '$');
    }
561082
def expect_re(self, regexp):
        
        prefix_len = self.match_prefix(
            self.prefix, self.next_line(require_prefix=False)
        )
        if prefix_len >= 0:
            match = self._expect_re(regexp, self.pos + prefix_len)
            self.match = match
            return match
        else:
            return None