File tree 2 files changed +20
-9
lines changed
main/java/ru/lanwen/verbalregex
test/java/ru/lanwen/verbalregex
2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -397,25 +397,25 @@ public Builder addModifier(final char pModifier) {
397
397
public Builder removeModifier (final char pModifier ) {
398
398
switch (pModifier ) {
399
399
case 'd' :
400
- modifiers ^= Pattern .UNIX_LINES ;
400
+ modifiers &= ~ Pattern .UNIX_LINES ;
401
401
break ;
402
402
case 'i' :
403
- modifiers ^= Pattern .CASE_INSENSITIVE ;
403
+ modifiers &= ~ Pattern .CASE_INSENSITIVE ;
404
404
break ;
405
405
case 'x' :
406
- modifiers ^= Pattern .COMMENTS ;
406
+ modifiers &= ~ Pattern .COMMENTS ;
407
407
break ;
408
408
case 'm' :
409
- modifiers ^= Pattern .MULTILINE ;
409
+ modifiers &= ~ Pattern .MULTILINE ;
410
410
break ;
411
411
case 's' :
412
- modifiers ^= Pattern .DOTALL ;
412
+ modifiers &= ~ Pattern .DOTALL ;
413
413
break ;
414
414
case 'u' :
415
- modifiers ^= Pattern .UNICODE_CASE ;
415
+ modifiers &= ~ Pattern .UNICODE_CASE ;
416
416
break ;
417
417
case 'U' :
418
- modifiers ^= Pattern .UNICODE_CHARACTER_CLASS ;
418
+ modifiers &= ~ Pattern .UNICODE_CHARACTER_CLASS ;
419
419
break ;
420
420
default :
421
421
break ;
Original file line number Diff line number Diff line change @@ -300,7 +300,7 @@ public void testWithAnyCase() {
300
300
}
301
301
302
302
@ Test
303
- public void testWithAnyCaseIsFalse () {
303
+ public void testWithAnyCaseTurnOnThenTurnOff () {
304
304
VerbalExpression testRegex = regex ()
305
305
.withAnyCase ()
306
306
.startOfLine ()
@@ -311,6 +311,17 @@ public void testWithAnyCaseIsFalse() {
311
311
assertThat (testRegex , not (matchesTo ("A" )));
312
312
}
313
313
314
+ @ Test
315
+ public void testWithAnyCaseIsFalse () {
316
+ VerbalExpression testRegex = regex ()
317
+ .startOfLine ()
318
+ .then ("a" )
319
+ .withAnyCase (false )
320
+ .build ();
321
+
322
+ assertThat (testRegex , not (matchesTo ("A" )));
323
+ }
324
+
314
325
@ Test
315
326
public void testSearchOneLine () {
316
327
VerbalExpression testRegex = regex ()
@@ -595,4 +606,4 @@ public void shouldAddMaybeWithOneOfFromAnotherBuilder() {
595
606
assertThat ("Is a name without prefix" , name , matchesTo ("James" ));
596
607
597
608
}
598
- }
609
+ }
You can’t perform that action at this time.
0 commit comments