Re: Is there something like Regexp#match_all

From: Andi S.

Sent: Monday, December 11, 2006 2:27 PM
To: ruby-talk ML
Subject: Is there something like Regexp#match_all

is there a possibility to return all the matches of a regexp? or in
other words is there a way to apply a block to all matches at once?
Something like String#gsub but where I can specifiy what to
do with the
matches…

See String#scan. It and #gsub both accept a block.