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) {
233
233
* @return this builder
234
234
*/
235
235
public Builder lineBreak () {
236
- return this .add ("(?:\\ n|(\\ r\\ n))" );
236
+ return this .add ("(?:\\ n|(?: \\ r\\ n))" );
237
237
}
238
238
239
239
/**
Original file line number Diff line number Diff line change 4
4
import org .junit .Test ;
5
5
6
6
import static org .hamcrest .CoreMatchers .equalTo ;
7
+ import static org .junit .Assert .assertEquals ;
7
8
import static org .junit .Assert .assertThat ;
8
9
import static ru .lanwen .verbalregex .VerbalExpression .regex ;
9
10
import static ru .lanwen .verbalregex .matchers .TestMatchMatcher .matchesTo ;
@@ -118,4 +119,18 @@ public void oneOfShouldFindEpisodeTitleOfStarWarsMovies() {
118
119
assertThat (regex , matchesTo ("Star Wars: The Empire Strikes Back" ));
119
120
assertThat (regex , matchesTo ("Star Wars: Return of the Jedi" ));
120
121
}
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
+ }
121
136
}
You can’t perform that action at this time.
0 commit comments