Skip to content

Commit

Permalink
bug fix for regular expression matches. now it returns all matches, n…
Browse files Browse the repository at this point in the history
…ot just one
  • Loading branch information
urbanadventurer committed Jan 8, 2011
1 parent ddcd29b commit 87f103b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/plugins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ def x
[:version,:model,:string,:firmware,:filepath].each do |symbol|
if !match[symbol].nil? and match[symbol].class==Regexp
if @body =~ match[:regexp_compiled]
regexpmatch = $~
regexpmatch = @body.scan(match[:regexp_compiled])
m = match.dup
m[symbol] = regexpmatch[match[:regexp_offset]+1]
m[symbol] = regexpmatch.map {|eachmatch| eachmatch[match[:regexp_offset]] }.flatten.sort.uniq
r << m
end
end
Expand Down Expand Up @@ -193,9 +193,9 @@ def x
[:version,:model,:string,:firmware,:filepath].each do |symbol|
if !match[symbol].nil? and match[symbol].class==Regexp
if @body =~ match[:regexp_compiled]
regexpmatch = $~
regexpmatch = @body.scan(match[:regexp_compiled])
m = match.dup
m[symbol] = regexpmatch[match[:regexp_offset]+1]
m[symbol] = regexpmatch.map {|eachmatch| eachmatch[match[:regexp_offset]] }.flatten.sort.uniq
r << m
end
end
Expand Down

0 comments on commit 87f103b

Please sign in to comment.