I need the MatchData for each occurrence of a regular expression in a string. This is different than the scan method suggested in Match All Occurrences of a Reg
MatchData
input = "abc12def34ghijklmno567pqrs" n = Regexp.new("\\d+") [n.match(input)].tap { |a| a << n.match(input,a.last().end(0)+1) until a.last().nil? }[0..-2] => [#, #, #]