Checks if string matches a regular expression

@param value1  a string value to match
@param value2 a regular expression string
@return true if the value matches regular expression and false otherwise.
344019
public static boolean match(Object value1, Object value2) {
		if (value1 == null && value2 == null)
			return true;
		if (value1 == null || value2 == null)
			return false;

		String string1 = value1.toString();
		String string2 = value2.toString();
		return string1.matches(string2);
	}
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);
        }
    }
761211
public String[] match(String value) {
        if (value == null) {
            return null;
        }
        for (Pattern pattern : patterns) {
            Matcher matcher = pattern.matcher(value);
            if (matcher.matches()) {
                int count = matcher.groupCount();
                String[] groups = new String[count];
                for (int j = 0; j < count; j++) {
                    groups[j] = matcher.group(j + 1);
                }
                return groups;
            }
        }
        return null;
    }
1173341
private boolean matchRegexp(String s, Pattern pattern) {
    final Matcher m = pattern.matcher(s);
    return m.matches();
  }
1338425
public static function matches(?string $value): bool
    {
        return $value !== null && 1 === preg_match(self::FORMATTER_PATTERN, $value);
    }
894041
static boolean hasMatchingToStringPair(Iterable<?> items1, Iterable<?> items2) {
    if (isEmpty(items1) || isEmpty(items2)) {
      return false; // Bail early to avoid calling hashCode() on the elements unnecessarily.
    }
    return !retainMatchingToString(items1, items2).isEmpty();
  }
974119
private function matchValue($value, $pattern)
    {
        // basic check
        if ($value == $pattern) {
            return true;
        }

        // simple check in case of optional param
        if ($pattern == '?') {
            return true;
        }

        // simple match in case pattern is just "*"
        if ($pattern == '*' && $value != '') {
            return true;
        }

        // more complex match in case when wildcard is part of a larger match
        $pattern = str_replace('*', '(.+)', $pattern);

        // regex match
        if (strpos($pattern, '(') !== false || strpos($pattern, '[') !== false || strpos($pattern, '\\') !== false) {
            return preg_match('#^' . $pattern . '$#', $value);
        }

        return false;
    }
1081948
public boolean hasIgnoringCase(String value)
    {
        if (values.isEmpty())
        {
            return false;
        }
        value = value.toLowerCase();
        for (String v : values)
        {
            if (v.toLowerCase().equals(value))
            {
                return true;
            }
        }
        return false;
    }
976286
public static boolean isSbeJavaName(final String value)
    {
        for (final String token : PATTERN.split(value, -1))
        {
            if (isJavaIdentifier(token))
            {
                if (isJavaKeyword(token))
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }

        return true;
    }
390489
public boolean containsStringConstant(String value) {
		int index = findUtf8(value);
		if (index == NOT_FOUND) return false;
		for (int i = 1; i < maxPoolSize; i++) {
			if (types[i] == STRING && readValue(offsets[i]) == index) return true; 
		}
		return false;
	}
1070935
public static boolean isSingleWord(String value) {
        if (value == null) {
            return false;
        }
        value = value.trim();
        if (value.isEmpty()) {
            return false;
        }
        return !SINGLE_WORD_PATTERN.matcher(value).matches();
    }
1157055
private int order(String value1, String value2) {
        int result = -1;

        if (value1 == value2) {
            result = 0;
        } else if (value1 != null) {
            if (value2 != null) {
                result = value1.compareTo(value2);
            } else {
                result = 1;
            }
        } else {
            result = -1;
        }

        return result;
    }
482011
private static boolean valueConstantsMatch(AbstractExpression e1, AbstractExpression e2) {
        return (e1 instanceof ParameterValueExpression && e2 instanceof ConstantValueExpression ||
                e1 instanceof ConstantValueExpression && e2 instanceof ParameterValueExpression) &&
                equalsAsCVE(e1, e2);
    }
767865
public static boolean matches(String pattern, String value) {
        Pattern p = Pattern.compile(pattern);
        Matcher m = p.matcher(value);
        return m.matches();
    }
40630
private boolean equalsNull(String value1, String value2) {
        return (value1 == value2 || value1 == null || (value1 != null && value1.equalsIgnoreCase(value2)));
    }
296790
public char match(String str1, String str2) {
        if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) {
            return IMappingElement.IDK;
        }
        float sim = 1 - (float) getLevenshteinDistance(str1, str2) / java.lang.Math.max(str1.length(), str2.length());
        if (threshold <= sim) {
            return IMappingElement.EQUIVALENCE;
        } else {
            return IMappingElement.IDK;
        }
    }
1131807
public static boolean isHexadecimal(String value) {

        if (value == null || value.length() == 0) {
            return false;
        }

        // validate string is hexadecimal value
        if (! HEX_REGEX_PATTERN.matcher(value).matches()) {
            return false;
        }

        return true;
    }