From: William James Date: 2005-12-15T10:02:52+09:00 Subject: Re: regular expressions question ako... wrote: > thank you. the question is general. > > if i wanted to parse a list of letters separated by spaces and commas: > > 'a , b,c' =~ /^(?:(\w)\s*,\s*)*(\w)$/ > > i need to get ['a','b'] in group 1 and ['c'] in group 2. yes, i know i > can split, then massage the result some more and get the final result. > is there a way to get to groups' captures after a regex match? like in > microsoft's .net? t = 'a , b,c'.split( /\s*,\s*/ ) group1 = t[0..-2] group2 = t[-1,1]