I am using groups to try to match on a certain pattern, and am not getting quite the results I expect. The pattern of interest are as follows:
([0-9]+(\.[0-9]+)+)
For string 1.23
, I get $1=1.23
, and $2=.23
which makes sense to me.
But for string 1.2.3
, I get $1=1.2.3
and $2=.3
, where I would expect $2=.2.3
, because its group is a decimal point and a digit, repeated.
Can someone please explain to me how this works? Thank you!