This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
for the above pattern .*? was not captured. Thus, disappeared.
You should wrap it with brackets as (.*?)
Because you have one more captured group, you should offset originals by 1
from $1-11-$3 to $1$2-11-$4
PS: you should only name constant (final variable with CAPITAL cases)
Check out the Javadoc page of java.util.regex.Pattern for what it means. As for when to use it, when you need to match any number of characters but you don't want it to take up more than it should. For instance, if you have a regex of ".*(\\d-)+\\d", and an input of "abc1-2-3", the ".*" will not match "abc" as you may expect but "abc1-", leaving only "2-3" for the second part. If you use ".*?(\\d-)+\\d", the ".*?" will not steal the "1-" away and only match "abc", leaving "1-2-3" for the second part.