If you're just trying to pull out the digits maybe
you should simplify.
output:
Pattern: (\d+) string=12345
matched: 12345
Pattern: (\d+) string=a1234
matched: 1234
Pattern: (\d+) string=12a34
matched: 12
matched: 34
Pattern: (\d+) string=1234a
matched: 1234
Pattern: (\d+) string=1234512345
matched: 1234512345
Pattern: (\d+) string=a1234a5234
matched: 1234
matched: 5234
Pattern: (\d+) string=a1234a5234
matched: 1234
matched: 5234
Pattern: (\d+) string=1234a5234a
matched: 1234
matched: 5234