Hi All,
I have the below Code from Chapter 6 of K&B Book
import java.util.regex.*;
class Regex2 {
public static void main(
String[] args) {
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
boolean b = false;
while(b = m.find()) {
System.out.print(m.start() + m.group());
}
}
}
And the command line:
java Regex2 "\d*" ab34ef
As per my understanding the Result should be 0123445 but as per the book the result is 01234456
I don't Understand from where the 6 has come as source "ab34ef" is of 6 characters with index position upto 5 only
Please explain me if anybody understand this well
Thanks
Srinivas