From: Ralf Mueller Date: 2010-02-07T03:57:35+09:00 Subject: Re: match/scan does not return multiple matches Michal Suchanek wrote: > Hello > > I tried scanning for multiple occurences of a group in a string and > match/scan would return only one. > > > "ajabcabck".match /^a*j(?:b*(a+)b+c*)+k$/ > => # > > "ajabcabck".scan /^a*j(?:b*(a+)b+c*)+k$/ > => [["a"]] > > > clearly the a+ group must match twice to match the string from ^ to $ > but only single match is returned. > > It is possible to use split instead but using a single match would be > much nicer. > > Any workaround? > > ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] > > > Thanks > > Michal > > Hi as far as i know, nested groups are not allowed. regular expressions do not form a language. regards ralf