Register a regex pattern to filter interest in certain Java types.
@param  sourceKey Identifier of who gave the pattern to us (so that we can update it).
This can be any arbitrary string.
326437
public static void registerInterest(String sourceKey, String regex, String rewritePattern, TypeReferenceLocation... locations)
    {
        patternsBySource.put(sourceKey, new PatternAndLocation(locations, regex, rewritePattern));
    }
594615
@Override
    public String tagKey(String key) {
        String conventionKey = NamingConvention.snakeCase.tagKey(key);

        String sanitized = tagKeyChars.matcher(conventionKey).replaceAll("_");
        if (!Character.isLetter(sanitized.charAt(0))) {
            sanitized = "m_" + sanitized;
        }
        return sanitized;
    }
325624
public static String stringMatcherByPattern(String input, String patternStr) {

        String output = PcConstants.SYSTEM_FAIL_MATCH_REGEX;

        // 20140105: fix the NPE issue
        if (patternStr == null) {
            logger.error("patternStr is NULL! (Expected when the aggregation rule is not defined at "
                    + PcDateUtils.getNowDateTimeStrStandard());
            return output;
        }

        if (input == null) {
            logger.error("input (Expected when the response is null and now try to match on response) is NULL in stringMatcherByPattern() at "
                    + PcDateUtils.getNowDateTimeStrStandard());
            return output;
        } else {
            input = input.replace("\n", "").replace("\r", "");
        }

        logger.debug("input: " + input);
        logger.debug("patternStr: " + patternStr);

        Pattern patternMetric = Pattern.compile(patternStr, Pattern.MULTILINE);

        final Matcher matcher = patternMetric.matcher(input);
        if (matcher.matches()) {
            output = matcher.group(1);
        }
        return output;
    }
1135711
protected Pattern compilePattern(Element regex, int flags) {

		Pattern p = null;
		try {
			String re = ((StringProperty) regex).getValue();
			p = Pattern.compile(re, flags);
		} catch (PatternSyntaxException pse) {
			throw EvaluationException.create(sourceRange, MSG_INVALID_REGEXP,
					pse.getLocalizedMessage());
		}

		return p;
	}
830330
private void checkInstancesMatchRegex(@Nullable String regex) {
        if (regex != null) {
            Pattern pattern = Pattern.compile(regex);
            instances().forEach(resource -> {
                String value = (String) resource.value();
                Matcher matcher = pattern.matcher(value);
                if (!matcher.matches()) {
                    throw TransactionException.regexFailure(this, value, regex);
                }
            });
        }
    }
1262141
private String transformKey(String key, String src, String tgt) {
        StringBuilder sb = new StringBuilder();
        String[] srcTokens = src.split(WILDCARD_DELIM_REGEX);
        String[] tgtTokens = tgt.split(WILDCARD_DELIM_REGEX);
        int len = Math.max(srcTokens.length, tgtTokens.length);
        int pos = 0;
        int start = 0;
        
        for (int i = 0; i <= len; i++) {
            String srcx = i >= srcTokens.length ? "" : srcTokens[i];
            String tgtx = i >= tgtTokens.length ? "" : tgtTokens[i];
            pos = i == len ? key.length() : pos;
            
            if ("*".equals(srcx) || "?".equals(srcx)) {
                start = pos;
            } else {
                pos = key.indexOf(srcx, pos);
                
                if (pos > start) {
                    sb.append(key.substring(start, pos));
                }
                
                start = pos += srcx.length();
                sb.append(tgtx);
            }
            
        }
        
        return sb.toString();
    }
706295
protected boolean check(String value, String regex) {
		Pattern pattern = Pattern.compile(regex);
		return pattern.matcher(value).matches();
	}
383797
public static boolean isMatch(final String regex, final CharSequence input) {
        return input != null && input.length() > 0 && Pattern.matches(regex, input);
    }
296560
public static boolean isValidInternalParamKey(String key) {
        char c = key.charAt(0);
        return c == RpcConstants.INTERNAL_KEY_PREFIX || c == RpcConstants.HIDE_KEY_PREFIX;
    }
32394
@Override
    public String tagKey(String key) {
        return KEY_CLEANUP_PATTERN.matcher(delegate.tagKey(key)).replaceAll("_");
    }
674649
def _get_string_match(self, key):
        

        expression = r'(?:\s*)'.join([
            '^',
            'define',
            r'\(',
            '\'{}\''.format(key),
            ',',
            r'\'(.*)\'',
            r'\)',
            ';'
        ])

        pattern = re.compile(expression, re.MULTILINE)
        return pattern.search(self._content)
911165
public static boolean regexMatch(String input, String regex) {
        return Pattern.compile(regex).matcher(input).matches();
    }
291648
void addSourceTargetSet(UnicodeSet filter, UnicodeSet sourceSet, UnicodeSet targetSet, UnicodeSet revisiting) {
        int limit = anteContextLength + keyLength;
        UnicodeSet tempSource = new UnicodeSet();
        UnicodeSet temp = new UnicodeSet();

        // We need to walk through the pattern.
        // Iff some of the characters at ALL of the the positions are matched by the filter, then we add temp to toUnionTo
        for (int i=anteContextLength; i<limit; ) {
            int ch = UTF16.charAt(pattern, i);
            i += UTF16.getCharCount(ch);
            UnicodeMatcher matcher = data.lookupMatcher(ch);
            if (matcher == null) {
                if (!filter.contains(ch)) {
                    return;
                }
                tempSource.add(ch);
            } else {
                try {
                    if (!filter.containsSome((UnicodeSet) matcher)) {
                        return;
                    }
                    matcher.addMatchSetTo(tempSource);
                } catch (ClassCastException e) { // if the matcher is not a UnicodeSet
                    temp.clear();
                    matcher.addMatchSetTo(temp);
                    if (!filter.containsSome(temp)) {
                        return;
                    }
                    tempSource.addAll(temp);
                }
            }
        }
        // if we made our way through the gauntlet, add to source/target
        sourceSet.addAll(tempSource);
        output.addReplacementSetTo(targetSet);
    }
66296
private static boolean match(String regExp, String userInput) {
        Pattern pattern = Pattern.compile(regExp);
        Matcher matcher = pattern.matcher(userInput);
        if (matcher.find())
            return true;
        else
            return false;
    }
1206616
public ParameterBuilder matching(String regex) {
        Validate.notNull(regex, "regex is required");
        this.pattern = Pattern.compile(regex);
        return this;
    }
1197023
public static Pattern createRegExPatternIfValid(String _regExStr) {
        if (StringUtil.isBlank(_regExStr)) {
            return null;
        }

        Pattern pattern;
        try {
            pattern = Pattern.compile(_regExStr);
        } catch (PatternSyntaxException _ex) {
            return null;
        }

        return pattern;
    }
1236049
public boolean containsKey(String inputKey) {
        String key = Normalizer.normalize(inputKey, Normalizer.NORMALIZE_LOWER);
        List<String> list = this.values.get(key);
        boolean rc = (null == list) ? false : !list.isEmpty();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "containsKey: key=" + inputKey + " rc=" + rc);
        }
        return rc;
    }