I've been trying to find something like this in the docs, but failed. What I want is to iterate over regular expression matches in a string, and passing MatchData
to the block.
- There's
Regexp#match
, but it only finds one match; - There's
String#scan
, but the block receives only the captures array or the match string, not fullMatchData
. This especially sucks with Oniguruma, as you lose the named capture capability. - There's also
Regexp::last_match
, so I could actually go thescan
route, but it seems ugly and inelegant.
Am I missing something?