I was looking at a code at TutorialsPoint and something has been bothering me since then... take a look at this code :
import java.util.regex.Matcher; import jav
(.*?)(\\d+)(.*)
Make your * greedy quantifier non greedy by putting *?.
*
*?
Because your first group (.*) is greedy it will capture evrything and will leave just one 0 for \d to capture.If you make it non greedy it will give you expected results.See demo.
(.*)
0
\d
https://regex101.com/r/tX2bH4/53