Have a look at this
SCJP FAQ entry, which explains this quite nicely.
The cliff notes version: the
? in the regex pattern is a greedy quantifier, which matches zero-length occurances of the preceeding pattern segment - in this case a zero-length occurance of "a" at index 3.
The fact that the index returned is beyond what you'd expect possible give the length of te
String adds to the confusion a bit, but that's related to how the Matcher processes the input.
More info on zero-length matches
here.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.