diff options
| author | Jack Nagel | 2013-04-27 15:21:06 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2013-04-27 15:21:06 -0500 | 
| commit | 839a821118fbe61d4c777a8c6adb4edb6f76a3fc (patch) | |
| tree | 0852f63370f4e79c77a34be1eb22f0bd9077ae68 /Library/Homebrew/version.rb | |
| parent | c7ba2b73e52147cbf93f50b2b9830b94850f5756 (diff) | |
| download | homebrew-839a821118fbe61d4c777a8c6adb4edb6f76a3fc.tar.bz2 | |
Avoid capturing groups when unnused
Diffstat (limited to 'Library/Homebrew/version.rb')
| -rw-r--r-- | Library/Homebrew/version.rb | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index efd7e3653..01e87c5d6 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -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  | 
