Used by `template()` to replace "escape" template delimiters with tokens.

@private
@param {String} match The matched template delimiter.
@param {String} value The delimiter value.
@returns {String} Returns a token.
19255
function tokenizeEscape(match, value) {
    var index = tokenized.length;
    tokenized[index] = "'+\n_.escape(" + value + ") +\n'";
    return token + index;
  }
300614
function replacer(key, value) {
        if (!value) {
            return value;
        }

        const type = typeof value;

        if (type === 'object') {
            if (isRegExp(value)) {
                return '@__R-' + UID + '-' + (regexps.push(value) - 1) + '__@';
            }

            return value;
        }

        if (type === 'function') {
            return '@__F-' + UID + '-' + (functions.push(value) - 1) + '__@';
        }

        return value;
    }
102218
function (url, key, value) {
                var regex = new RegExp("([?|&])" + key + "=.*?(&|#|$)(.*)", "gi"),
                    separator,
                    hash;

                if (regex.test(url)) {
                    url = url.replace(regex, '$1' + key + "=" + value + '$2$3');
                } else {
                    separator = url.indexOf('?') !== -1 ? '&' : '?';
                    hash = url.split('#');
                    url = hash[0] + separator + key + '=' + value;
                }
                return url;
            }
833689
public static boolean valueMatchesRegularExpression(String val, Pattern regexp) {
		Matcher m = regexp.matcher(val);

		try {
			return m.matches();
		} catch (StackOverflowError e) {
			e.printStackTrace();
			System.out.println("-> [" + val + "][" + regexp + "]");
			System.out.println("-> " + val.length());
			System.exit(0);
		}
		return false;
	}
301973
function getTokenType(match) {
  const [offset, text] = match.slice(-2);
  const token = matchToToken(match);

  if (token.type === "name") {
    if (esutils.keyword.isReservedWordES6(token.value)) {
      return "keyword";
    }

    if (
      JSX_TAG.test(token.value) &&
      (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")
    ) {
      return "jsx_tag";
    }

    if (token.value[0] !== token.value[0].toLowerCase()) {
      return "capitalized";
    }
  }

  if (token.type === "punctuator" && BRACKET.test(token.value)) {
    return "bracket";
  }

  if (
    token.type === "invalid" &&
    (token.value === "@" || token.value === "#")
  ) {
    return "punctuator";
  }

  return token.type;
}
506378
function stripToken(val, exp) {
    exp = exp || constants_2.TOKEN_ANY_EXP;
    return val.trim().replace(exp, '');
}
72306
private static boolean matchRuleRegex(String regex, String value) {

        if (value == null) {
            value = "";
        }

        if (regex == null) {
            return true;
        }
        if ((regex.length() > 0) && (regex.charAt(0) == '!')) {
            return !value.matches(regex.substring(1));
        } else {
            return value.matches(regex);
        }
    }
1095689
function ( from_value, to_value ) {

        var type;

        if ( from_value instanceof RegExp ) {

            type = 'RegExp';

        } else if ( typeof from_value === 'string' ) {

            type = 'String';

        } else {

            throw { type: 'changeURLContent', message: 'First argument must be RegExp of String' };

        }

        if ( to_value === undefined ) {

            to_value = "";

        } else if( typeof to_value !== 'string' ) {

            throw { type: 'changeURLContent', message: 'Second argument must be String' };

        }

        urls.filter( function ( value ) {

            if ( type === "RegExp" ) {

                return from_value.test( _getURLValue( value ) );

            } else {

                return _getURLValue( value ).indexOf( from_value ) !== -1;

            }

        } ).forEach( function ( value ) {

            var new_value = _getURLValue( value ).replace( from_value, to_value );
            _setURLValue( value, new_value );

        } );

    }
667268
function _matchRegExp(val) {
  const expression = `${_escapeRegExp(val)}($|\\s|\\>|\\+|~|\\:|\\[)`;
  let expressionPrefix = '(^|\\s|\\>|\\+|~)';
  if (_isPlaceholder(val)) {
    // We just want to match an empty group here to preserve the arguments we
    // may be expecting in a RegExp match.
    expressionPrefix = '()';
  }
  return new RegExp(expressionPrefix + expression, 'g');
}
7868
function hostregexp (val) {
  var source = !isregexp(val)
    ? String(val).replace(ESCAPE_REGEXP, ESCAPE_REPLACE).replace(ASTERISK_REGEXP, ASTERISK_REPLACE)
    : val.source

  // force leading anchor matching
  if (source[0] !== '^') {
    source = '^' + source
  }

  // force trailing anchor matching
  if (!END_ANCHORED_REGEXP.test(source)) {
    source += '$'
  }

  return new RegExp(source, 'i')
}
181557
function isRegExp(value) {
      var type = typeof value;
      return value && (type == 'function' || type == 'object') &&
        toString.call(value) == regexpClass || false;
    }
327739
function coerceElementMatchingCallback(value) {
  // Element Name
  if (typeof value === 'string') {
    return element => element.element === value;
  }

  // Element Type
  if (value.constructor && value.extend) {
    return element => element instanceof value;
  }

  return value;
}
583070
function match_code( $value ) {
		$code = parent::match_code( '' ) ;
		return $value ? $code->replace( array( 'FAIL' => NULL )) : $code ;
	}
621364
public static String escapeJsRegex(SoyValue value) {
    value = normalizeNull(value);
    return escapeJsRegex(value.coerceToString());
  }
495569
function match(value, regExp, message, id) {
    if (message === void 0) { message = ''; }
    if (id === void 0) { id = ''; }
    if (this.enabled && !regExp.test(value)) {
        throw LogicException.throw(assertionTypes.MATCH, value, message, id);
    }
}
1034685
function regExpBuilder (find) {
  const regExpRe = /\/(.*)\/(\w*)/
  if (find) {
    if (regExpRe.test(find)) {
      const matches = find.match(regExpRe)
      const pattern = matches[1]
      const flags = matches[2]
      return new RegExp(pattern, flags)
    } else {
      return find
    }
  } else {
    return null
  }
}
601189
function replace(regex, source, options) {
  var valueOrFn = getValueOrMatchFn(options.value)
  source.replace(regex, function () { return '' })
  return source.replace(regex, valueOrFn)
}