I am trying to capture a recursive sequence using matching repetition with capturing groups.
Here is a sample text:
some_string_here 00 12.34 34 56.78 78.90
The regexp used to capture all the floating point values:
\S+(?:\s+(\d+(?:\.\d+)?)){5}
The regexp matches all the floating point values as expected but the capturing group returns only the final match result.
Group #1: 78.90
The required result is:
Group #1: 00
Group #2: 12.34
Group #3: 34
Group #4: 56.78
Group #5: 78.90
If I use the following as the regexp, the result is as expected, but with too many recursive sequence, the regexp is too long.
\S+(?:\s+(\d+(?:\.\d+)?))(?:\s+(\d+(?:\.\d+)?))(?:\s+(\d+(?:\.\d+)?))(?:\s+(\d+(?:\.\d+)?))(?:\s+(\d+(?:\.\d+)?))
Is there a way to capture all of the floating point values in a matching repetition with capturing groups?