Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
public class TestFileNamePatternParser
{
public static final String SRC_FILE_VARIABLE = "${srcFile}";
private static final Pattern CHARS_TO_ESCAPE = Pattern.compile("([\\*\\(\\)\\|])");

private final String patternToParse;
private final NameTokenizer tokenizer;

Expand Down Expand Up @@ -151,7 +149,11 @@ private UserDefinedPart(String str, String separator)

private static String escapeCharsWhereNeeded(String str)
{
return CHARS_TO_ESCAPE.matcher(str).replaceAll(quoteReplacement("\\$1"));
// PERFORMANCE: Use chained literal String.replace instead of regex Matcher.replaceAll
return str.replace("*", "\\*")
.replace("(", "\\(")
.replace(")", "\\)")
.replace("|", "\\|");
}

private void parse()
Expand Down
Loading