How can I write a regex for parsing version numbers. I want to match numbers like: 1.000
, 1.0.00
, 1.0.0.000
but not integers 1
Clarification: I'm assuming you want to parse the numbers, not just match them.
Why use regexes when a simple split will work just fine?
'1.3.4.*'.split('.')
# => ['1', '3', '4', '*']
If you want to ensure that there is at least one dot in the string, check the array length to ensure it is larger than 1.