Skip to content

Commit 920de1f

Browse files
author
Tim te Beek
authored
Avoid even more special characters to avoid alternative text expressions (#269)
https://github.com/cucumber/cucumber-expressions/blob/main/README.md#alternative-text
1 parent 8b3d5cc commit 920de1f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/openrewrite/java/testing/cucumber/RegexToCucumberExpression.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ private static J.Annotation replaceRegexWithCucumberExpression(
105105
String replacement = stripAnchors(possibleExpression.get());
106106

107107
// Back off when special characters are encountered in regex
108-
if (Stream.of("(", ")", "{", "}", "[", "]", "?", "*", "+").anyMatch(replacement::contains)) {
108+
if (Stream.of("(", ")", "{", "}", "[", "]", "?", "*", "+", "/", "\\", "^", "|")
109+
.anyMatch(replacement::contains)) {
109110
return annotation;
110111
}
111112

0 commit comments

Comments
 (0)