given:
import java.util.regex.*;
class A {
public static void main (
String[] args) {
boolean b = false;
String s = "\\d*";
String t = "ab34ef";
Pattern p = Pattern.compile(s);
Matcher m = p.matcher(t);
while (b = m.find() {
System.out.println(m.start() + m.group());
}
}
The output from this is 01234456.
How does the index value of 6 ever get printed? Shouldn't
5 be the largest number possible for the m.start() value?