Maur?cio wrote:
> Hi,
> 
>     The following code is supposed to print multiple regular expression
> matches on a given string:

Why not use scan?

   "foo bar baz".scan(/\w\w\w/) { |str| puts str }

       # ==> foo
       #     bar
       #     baz