From: Iain Barnett Date: 2010-07-09T01:38:48+09:00 Subject: Re: Regular expressions, capture repeated groups --Apple-Mail-1--347792564 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 8 Jul 2010, at 16:15, w_a_x_man wrote: >>=20 >=20 > "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 >=20 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 (? ) grouping, which would = be phenomenally useful, because scan returns arrays of strings and not = matchdata. Iain= --Apple-Mail-1--347792564--