From: "David A. Black" Date: 2004-11-10T20:09:03+09:00 Subject: Re: scan returning matchdata Hi -- On Wed, 10 Nov 2004, trans. (T. Onoma) wrote: > Wouldn't it be more useful if String#scan returned an array of MatchData? I don't think so; most of the time, for me anyway, the array elements are directly useful, and if they were returned embedded in a MatchData object, I'd just end up having to dig them out. > Assuming that back compatibility should be preserved here, could we at least > get an alternate method that does so, say #mscan ? It's pretty easy: def mscan(str,re) m = [] str.scan(re) { m << $~ } m end David -- David A. Black dblack@wobblini.net