Matcher m = Pattern.compile("(?=(..))").matcher("12345"); while (m.find()) { System.out.println(m.group(1)); } // prints "12", "23", "34", "45"This is the most instructive pattern I've seen BY FAR. The most important revelations for me are:
- You can capture during lookaround! Which means that...
- Group zero is not necessarily a superstring of all the other groups!
No comments:
Post a Comment