WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed
main/java/ru/lanwen/verbalregex
test/java/ru/lanwen/verbalregex Expand file tree Collapse file tree 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) {
397397 public Builder removeModifier (final char pModifier ) {
398398 switch (pModifier ) {
399399 case 'd' :
400- modifiers ^= Pattern .UNIX_LINES ;
400+ modifiers &= ~ Pattern .UNIX_LINES ;
401401 break ;
402402 case 'i' :
403- modifiers ^= Pattern .CASE_INSENSITIVE ;
403+ modifiers &= ~ Pattern .CASE_INSENSITIVE ;
404404 break ;
405405 case 'x' :
406- modifiers ^= Pattern .COMMENTS ;
406+ modifiers &= ~ Pattern .COMMENTS ;
407407 break ;
408408 case 'm' :
409- modifiers ^= Pattern .MULTILINE ;
409+ modifiers &= ~ Pattern .MULTILINE ;
410410 break ;
411411 case 's' :
412- modifiers ^= Pattern .DOTALL ;
412+ modifiers &= ~ Pattern .DOTALL ;
413413 break ;
414414 case 'u' :
415- modifiers ^= Pattern .UNICODE_CASE ;
415+ modifiers &= ~ Pattern .UNICODE_CASE ;
416416 break ;
417417 case 'U' :
418- modifiers ^= Pattern .UNICODE_CHARACTER_CLASS ;
418+ modifiers &= ~ Pattern .UNICODE_CHARACTER_CLASS ;
419419 break ;
420420 default :
421421 break ;
Original file line number Diff line number Diff line change @@ -300,7 +300,7 @@ public void testWithAnyCase() {
300300 }
301301
302302 @ Test
303- public void testWithAnyCaseIsFalse () {
303+ public void testWithAnyCaseTurnOnThenTurnOff () {
304304 VerbalExpression testRegex = regex ()
305305 .withAnyCase ()
306306 .startOfLine ()
@@ -311,6 +311,17 @@ public void testWithAnyCaseIsFalse() {
311311 assertThat (testRegex , not (matchesTo ("A" )));
312312 }
313313
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+
314325 @ Test
315326 public void testSearchOneLine () {
316327 VerbalExpression testRegex = regex ()
@@ -595,4 +606,4 @@ public void shouldAddMaybeWithOneOfFromAnotherBuilder() {
595606 assertThat ("Is a name without prefix" , name , matchesTo ("James" ));
596607
597608 }
598- }
609+ }
You can’t perform that action at this time.
0 commit comments