From: Guillaume Marcais Date: 2004-05-15T01:02:48+09:00 Subject: Re: Regexp Error? On Fri, 2004-05-14 at 11:47, Simon Strandgaard wrote: > > my engine uses loop-detection, it thus outputs more desired results. > http://raa.ruby-lang.org/list.rhtml?name=regexp > > For instance my engine outputs > /a(a|)*/ ~= 'aaab' -> ['aaa', 'a'] > /a(|ab)*b/ ~= 'aaabbb' -> ['aabb', 'ab'] > /x(y?)*z/ ~= 'xyz' -> ['xyz', 'y'] > /x(y{0,2})*z/ ~= 'xyz' -> ['xyz', 'y'] > If you try the same examples with Gnu or Oniguruma, you will see the last elements > are empty, I guess this is because they use the empty-token concept. > Huh? False advertisement? [gus@comp tmp]$ cat regexp.rb p /a(a|)*/.match('aaab').to_a p /a(|ab)*b/.match('aaabbb').to_a p /x(y?)*z/.match('xyz').to_a p /x(y{0,2})*z/.match('xyz').to_a [gus@comp tmp]$ ruby regexp.rb ["aaa", "a"] ["aabb", "ab"] ["xyz", "y"] ["xyz", "y"] [gus@comp tmp]$ ruby -v ruby 1.8.1 (2004-03-31) [i586-linux-gnu] Guillaume.