I have something like:
public final class RegexHelpers {
private RegexHelpers() {
}
public static Pattern getUnescapedSymbolPattern(char symbol) {
return Pattern.compile(getUnescapedSymbolRegex(symbol));
}
public static String getUnescapedSymbolRegex(char symbol) {
String escapedSymbol = Pattern.quote(String.valueOf(symbol));
return "(^|[^\\\\])(\\\\\\\\)*" + escapedSymbol; // (^|[^\\])(\\\\)*,
}
}
Which gives a NON_STATIC_PATTERN_COMPILE_CALL.
I also have another case of a false positive in code like:
private boolean propertyMatchesText(String test, String text, boolean shouldMatchWholeString) {
String pcre = SomeHelpers.textToPcre(text, shouldMatchWholeString);
int caseInsensitiveFlag = isCaseInsensitive() ? Pattern.CASE_INSENSITIVE : 0;
Pattern pattern = Pattern.compile(pcre, caseInsensitiveFlag | Pattern.UNICODE_CASE);
return pattern.matcher(test).find();
}
I have something like:
Which gives a
NON_STATIC_PATTERN_COMPILE_CALL.I also have another case of a false positive in code like: