Todd Benson
4/2/2008 2:32:00 PM
On Wed, Apr 2, 2008 at 8:20 AM, Oliver Saunders
<oliver.saunders@gmail.com> wrote:
> Given that:
>
> %r{(\w,)+}.match('a,b,c')[0] #=> "a,b,"
>
> and
>
> %r{(\w,)+}.match('a,b,c')[1] #=> "b,"
>
> How do I access the capture that contains "a,"?
Maybe leave the plus symbol (+) out?
r = /(\w,)/
r.match('hi,a,b,c')[1]
=> "i,"
I'd probably use #scan, or even #split, instead.
Todd