From: Unmesh Gundecha Date: 2008-06-09T19:51:34+09:00 Subject: Re: String extraction using RegExp Stefano Crocco wrote: > Regexp.match and String.match only return the first match. If you want > to get > all matches, you can use either String#scan or class StringScanner. In > your > case, I think the better choice is the former: > > str = 'Page("New User Registration").Frame("New User")' > str.scan(r1) > => [["New User Registration"], ["New User"]] > > String#scan scans the string for all matches and returns an array of > arrays. > Each subarray contains all the groups for the corresponding match (if > the > regexp doesn't contain groups, then String#scan returns an array of > strings, > each of which is the matched text). > > I hope this helps > > Stefano Thanks Stefano, String#scan worked for me. Cheers!! Unmesh -- Posted via http://www.ruby-forum.com/.