7
I am running this regular expression to separate the digits of a version:
([\d]+)+
As you can see in this example, it works well enough to cover my needs.
However, I have to add this treatment in a Perl script, which is not by far my specialty. I run my regex and then try to recover group values.
$version="2.2.1-ALPHA30";
$version=~/([\d]+)+/g;
print "major:$1 minor:$2 revision:$3 build:$4\n"
First I only have $1
that is shown, the others are empty.
And finally, I see no way of knowing how many values were found by the regex.
I updated the answer, did not see that you needed to know also the amount of numbers found.
– stderr
I need the amount so I can treat further and manage the degraded cases
– Pedro Witzel