SCJP6 regex issue
I have issue with following example: 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 Can someone explain me, why the result is: 01234456 regex pattern is d* - it means number one or more but there are more positions that in args[1], thanks \d* matches 0 or more digits. So, it will even match empty string before every character and after the last character.