--Apple-Mail-1--347792564
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset-ascii


On 8 Jul 2010, at 16:15, w_a_x_man wrote:
>> 
> 
> "The the quick brown fox  fox jumped over the lazy dog dog.".
> scan(/((\w+) +\2)/i){|x| puts "#{ x[0] } #{ $~.offset(0)[0]}"}
> The the 0
> fox  fox 20
> dog dog 50
> 

Thanks for that. That would certainly work to a degree, much better than my current alternative, but it nullifies the usefulness of named captures. For example, I can't call

$ md1[:first]

and get back all the matches for the (?<first> ) grouping, which would be phenomenally useful, because scan returns arrays of strings and not matchdata.


Iain-Apple-Mail-1--347792564--