Skip to content
Snippets Groups Projects
Commit c2889de3 authored by Jack Nagel's avatar Jack Nagel
Browse files

Avoid capturing groups when unnused

parent 364c5c34
No related branches found
No related tags found
No related merge requests found
......@@ -127,44 +127,44 @@ class Version
return m.captures.first unless m.nil?
# 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?
# e.g. boost_1_39_0
m = /((\d+_)+\d+)$/.match(stem)
m = /((?:\d+_)+\d+)$/.match(stem)
return m.captures.first.gsub('_', '.') unless m.nil?
# e.g. foobar-4.5.1-1
# 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?
# e.g. lame-398-1
m = /-((\d)+-\d)/.match(stem)
m = /-((?:\d)+-\d)/.match(stem)
return m.captures.first unless m.nil?
# e.g. foobar-4.5.1
m = /-((\d+\.)*\d+)$/.match(stem)
m = /-((?:\d+\.)*\d+)$/.match(stem)
return m.captures.first unless m.nil?
# 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?
# 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?
# e.g. foobar4.5.1
m = /((\d+\.)*\d+)$/.match(stem)
m = /((?:\d+\.)*\d+)$/.match(stem)
return m.captures.first unless m.nil?
# 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?
# 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?
# e.g. http://www.openssl.org/source/openssl-0.9.8s.tar.gz
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment