Avoid capturing groups when unnused
This commit is contained in:
parent
364c5c3473
commit
c2889de323
@ -127,44 +127,44 @@ class Version
|
|||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)
|
# e.g. https://github.com/erlang/otp/tarball/OTP_R15B01 (erlang style)
|
||||||
m = /[-_](R\d+[AB]\d*(-\d+)?)/.match(spec_s)
|
m = /[-_](R\d+[AB]\d*(?:-\d+)?)/.match(spec_s)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. boost_1_39_0
|
# e.g. boost_1_39_0
|
||||||
m = /((\d+_)+\d+)$/.match(stem)
|
m = /((?:\d+_)+\d+)$/.match(stem)
|
||||||
return m.captures.first.gsub('_', '.') unless m.nil?
|
return m.captures.first.gsub('_', '.') unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar-4.5.1-1
|
# e.g. foobar-4.5.1-1
|
||||||
# e.g. ruby-1.9.1-p243
|
# e.g. ruby-1.9.1-p243
|
||||||
m = /-((\d+\.)*\d\.\d+-(p|rc|RC)?\d+)(?:[-._](?:bin|dist|stable|src|sources))?$/.match(stem)
|
m = /-((?:\d+\.)*\d\.\d+-(?:p|rc|RC)?\d+)(?:[-._](?:bin|dist|stable|src|sources))?$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. lame-398-1
|
# e.g. lame-398-1
|
||||||
m = /-((\d)+-\d)/.match(stem)
|
m = /-((?:\d)+-\d)/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar-4.5.1
|
# e.g. foobar-4.5.1
|
||||||
m = /-((\d+\.)*\d+)$/.match(stem)
|
m = /-((?:\d+\.)*\d+)$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar-4.5.1b
|
# e.g. foobar-4.5.1b
|
||||||
m = /-((\d+\.)*\d+([abc]|rc|RC)\d*)$/.match(stem)
|
m = /-((?:\d+\.)*\d+(?:[abc]|rc|RC)\d*)$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar-4.5.0-beta1, or foobar-4.50-beta
|
# e.g. foobar-4.5.0-beta1, or foobar-4.50-beta
|
||||||
m = /-((\d+\.)*\d+-beta(\d+)?)$/.match(stem)
|
m = /-((?:\d+\.)*\d+-beta\d*)$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar4.5.1
|
# e.g. foobar4.5.1
|
||||||
m = /((\d+\.)*\d+)$/.match(stem)
|
m = /((?:\d+\.)*\d+)$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. foobar-4.5.0-bin
|
# e.g. foobar-4.5.0-bin
|
||||||
m = /-((\d+\.)+\d+[abc]?)[-._](bin|dist|stable|src|sources?)$/.match(stem)
|
m = /-((?:\d+\.)+\d+[abc]?)[-._](?:bin|dist|stable|src|sources?)$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. dash_0.5.5.1.orig.tar.gz (Debian style)
|
# e.g. dash_0.5.5.1.orig.tar.gz (Debian style)
|
||||||
m = /_((\d+\.)+\d+[abc]?)[.]orig$/.match(stem)
|
m = /_((?:\d+\.)+\d+[abc]?)[.]orig$/.match(stem)
|
||||||
return m.captures.first unless m.nil?
|
return m.captures.first unless m.nil?
|
||||||
|
|
||||||
# e.g. http://www.openssl.org/source/openssl-0.9.8s.tar.gz
|
# e.g. http://www.openssl.org/source/openssl-0.9.8s.tar.gz
|
||||||
|
Loading…
x
Reference in New Issue
Block a user