Skip to content

Commit 2ab1ed2

Browse files
committed
Merge pull request #51 from joe-mojo/master
Added missing Macintosh line break
2 parents 808a28f + 0b18e0f commit 2ab1ed2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/ru/lanwen/verbalregex/VerbalExpression.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public Builder somethingButNot(final String pValue) {
233233
* @return this builder
234234
*/
235235
public Builder lineBreak() {
236-
return this.add("(?:\\n|(?:\\r\\n))");
236+
return this.add("(?:\\n|(?:\\r\\n)|(?:\\r\\r))");
237237
}
238238

239239
/**

src/test/java/ru/lanwen/verbalregex/BasicFunctionalityUnitTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,18 @@ public void testLineBreak() {
178178
assertThat("abc then line break then space then def", testRegex, not(matchesTo("abc\r\n def")));
179179
}
180180

181+
@Test
182+
public void testMacintoshLineBreak() {
183+
VerbalExpression testRegex = new VerbalExpression.Builder()
184+
.startOfLine()
185+
.then("abc")
186+
.lineBreak()
187+
.then("def")
188+
.build();
189+
190+
assertThat("abc then line break then def", testRegex, matchesTo("abc\r\rdef"));
191+
}
192+
181193
@Test
182194
public void testBr() {
183195
VerbalExpression testRegexBr = new VerbalExpression.Builder()

0 commit comments

Comments
 (0)