Clean up /bin/df regexp

- remove unnecessary captures
 - '%' is not a metacharacter so it doesn't need to be escaped
 - match using '+' instead of '*'
This commit is contained in:
Jack Nagel 2014-07-09 16:53:37 -05:00
parent 5ab16295e5
commit 82ce0be6fd

View File

@ -35,8 +35,8 @@ class Volumes
io.each_line do |line|
case line.chomp
# regex matches: /dev/disk0s2 489562928 440803616 48247312 91% /
when /^(.*)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]{1,3}\%)\s+(.*)/
vols << $6
when /^.+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]{1,3}%\s+(.+)/
vols << $1
end
end
end