[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Is there something like Regexp#match_all

Gavin Kistner

12/11/2006 9:35:00 PM

From: Andi Schacke
> 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.