diff options
| author | Jack Nagel | 2013-04-27 15:21:06 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-04-27 15:21:06 -0500 |
| commit | c2889de323b5d5e31f634ba279268e51344c796d (patch) | |
| tree | f578f7f07df278aca45c70da9597cd82d2e318e8 /Library | |
| parent | 364c5c34733a3b941e2310f1d4b2899075ee303d (diff) | |
| download | brew-c2889de323b5d5e31f634ba279268e51344c796d.tar.bz2 | |
Avoid capturing groups when unnused
Diffstat (limited to 'Library')
| -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 |
