If we call a 5 digit number “Y” and a non-numeral X, your pattern matches: XYX
your input string is ...XYXYXYXYXYXYXYXYX...
if your input string were ...XYXXYXXYXXYXXYXXYXXYX...
then you would get the results you are expecting.
This isn’t a java problem - it’s defining your regex correctly; i don’t know the homogeneity of the patterns in your data, but if they are like the input line where you have XXXXXXXXYXYXYXYXYX...X
then dump the first \\D in your pattern.
There are some great regex resources online so your can figure these things out for yourself - like https://www.freeformatter.com/java-regex-tester.html and https://regexr.com/