Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Pattern pattern1 = Pattern.compile( "(?:(.)\\1|.0|0.)*" ); // BAD, 00 matches at least two options within iteration
- Pattern pattern2 = Pattern.compile( "(?:(.)\\1|[^0]0|0[^0])*" ); // GOOD, options are made disjoint
- Pattern pattern3 = Pattern.compile( "(?>(.)\\1|.0|0.)*" ); // GOOD, prefix-free sets can be made atomic safely
- Matcher matcher = pattern1.matcher( "000000000000000000000000000000000" );
- matcher.matches();
Advertisement
Add Comment
Please, Sign In to add comment