diff --git a/rewrite-core/src/test/java/org/openrewrite/text/FindTest.java b/rewrite-core/src/test/java/org/openrewrite/text/FindTest.java index 61fb80d37f4..b30110349a7 100644 --- a/rewrite-core/src/test/java/org/openrewrite/text/FindTest.java +++ b/rewrite-core/src/test/java/org/openrewrite/text/FindTest.java @@ -144,6 +144,25 @@ void regexWithoutMultilineAndDotall() { ) ); } + @Test + void regexMatchingWhitespaceWithoutMultilineWithDotall() { + rewriteRun( + spec -> spec.recipe(new Find("One.Two$", true, true, false, true, null)), + //language=csv + text( // the `.` above matches the space character on the same line + """ + Zero + One Two + Three + """, + """ + Zero + ~~>One Two + Three + """ + ) + ); + } @Test void regexWithoutMultilineAndWithDotAll() { @@ -197,15 +216,15 @@ void regexWithBothMultilineAndDotAll() { spec -> spec.recipe(new Find("^This.*below\\.$", true, true, true, true, null)), text( """ - This is text. + The first line. This is a line below. This is a line above. This is text. This is a line below. """, """ - ~~>This is text. - This is a line below. + The first line. + ~~>This is a line below. This is a line above. This is text. This is a line below.