Skip to content
Closed
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 @@ -24,7 +24,7 @@

@API(status = API.Status.STABLE)
public final class CucumberExpression implements Expression {
private static final Pattern ESCAPE_PATTERN = Pattern.compile("([\\\\^\\[({$.|?*+})\\]])");
private static final Pattern ESCAPE_PATTERN = Pattern.compile("[\\\\^\\[({$.|?*+})\\]]");

private final List<ParameterType<?>> parameterTypes = new ArrayList<>();
private final String source;
Expand Down Expand Up @@ -62,7 +62,7 @@ private String rewriteToRegex(Node node) {
}

private static String escapeRegex(String text) {
return ESCAPE_PATTERN.matcher(text).replaceAll("\\\\$1");
return ESCAPE_PATTERN.matcher(text).replaceAll("\\\\$0");
}

private String rewriteOptional(Node node) {
Expand Down