File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
main/java/ru/lanwen/verbalregex
test/java/ru/lanwen/verbalregex Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff 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))" );
237237 }
238238
239239 /**
Original file line number Diff line number Diff line change 44import org .junit .Test ;
55
66import static org .hamcrest .CoreMatchers .equalTo ;
7+ import static org .junit .Assert .assertEquals ;
78import static org .junit .Assert .assertThat ;
89import static ru .lanwen .verbalregex .VerbalExpression .regex ;
910import static ru .lanwen .verbalregex .matchers .TestMatchMatcher .matchesTo ;
@@ -118,4 +119,18 @@ public void oneOfShouldFindEpisodeTitleOfStarWarsMovies() {
118119 assertThat (regex , matchesTo ("Star Wars: The Empire Strikes Back" ));
119120 assertThat (regex , matchesTo ("Star Wars: Return of the Jedi" ));
120121 }
122+
123+ @ Test
124+ public void captureAfterNewLineHasGroupNumberOne () throws Exception {
125+
126+ final String line_break = "\n " ;
127+ final String some = "some" ;
128+ final String text = " text" ;
129+ final VerbalExpression expression = VerbalExpression .regex ().
130+ lineBreak ()
131+ .capture ().find (some ).endCapture ().then (text )
132+ .build ();
133+
134+ assertEquals (some , expression .getText (line_break + some + text , 1 ));
135+ }
121136}
You can’t perform that action at this time.
0 commit comments