I want to be able to identify which version is version 6, version 5,
etc..
I'm not sure if a regex is the best way. I need to be able to say that #1-4 are version 6 and #5 is version 5. But I need to be able to
identify versions 1-8. Also, what if I need to identify, specifically,
version 5.5 and 5.6?
I want to be able to identify which version is version 6, version 5,
etc..
I'm not sure if a regex is the best way. I need to be able to say that #1-4 are version 6 and #5 is version 5. But I need to be able to
identify versions 1-8. Also, what if I need to identify, specifically,
version 5.5 and 5.6?
versions = str.map {|v| v.gsub(/\D/, '')[0,1]}
=> ["6", "6", "6", "6", "5"]
That will get you the major version numbers. If you want minors, etc.,
you'll need a more specific format, I think. Otherwise, you couldn't
be sure that 'abc 600-qwer' is version 6, 60, or 600. If you assume
the major is a single digit:
> I want to be able to identify which version is version 6, version 5,
> etc..
> I'm not sure if a regex is the best way. I need to be able to say that
> #1-4 are version 6 and #5 is version 5. But I need to be able to
> identify versions 1-8. Also, what if I need to identify, specifically,
> version 5.5 and 5.6?