I have strings like:
1.2.3
1.4.0.136
V312
V10
2.2.2
r1elease2.0.0
Vr 1.5.1
I want to get regex that should extract versions (without string) out of these strings and arrange in sorter order. Any two strings can be passed at a time to compare.
1.2.3 should become 1.2.3 (no change)
1.4.0.136 should become 1.4.0.136 (no change)
V312 should become 312
V10 should become 10
2.2.2 should become 2.2.2 (no change)
r1elease2.0.0 should become 2.0.0
Vr 1.5.1 should become 1.5.1
I tried /[^0-9\.]+/g but it didn't worked in case r1elease2.0.0 as this string became 12.0.0 which is incorrect.
/\d+(\.?\d+)+/g1.0.0-SNAPSHOT?