From: Alessandro Re Date: 2007-08-01T00:18:51+09:00 Subject: Re: Multiple matching with ()* Thanks, this is an interesting solution! On 7/31/07, Robert Klemme wrote: > 2007/7/31, Alessandro Re : > > Mh well, to me it seems a normal regex processing (i mean, it *should* > > require only one instruction, since this pattern can be read with just > > one regex, even if ruby doesn't allow it... but it would be really > > bad). > > Anyway well, splitting it there are different ways to do it - thanks > > for your sudjestion. > > But if ruby make it possible with one call, i'd prefer to use it. > > irb(main):006:0> s="x1A2B3C4Dz" > => "x1A2B3C4Dz" > irb(main):007:0> s.scan /x(\d\w)*z/ > => [["4D"]] > irb(main):008:0> s.scan /x((?:\d\w)*?)z/ > => [["1A2B3C4D"]] > irb(main):009:0> s.scan(/x((?:\d\w)*?)z/).map {|a| a[0].scan(/\d\w/)} > => [["1A", "2B", "3C", "4D"]] > > Kind regards > > robert > > -- ~Ale