From: Simon Strandgaard Date: 2004-05-14T23:49:45+09:00 Subject: Re: Regexp Error? ts wrote: > >>>>> "S" == Simon Strandgaard writes: > > S> Lets break it down > > svg% ruby -rjj -e '"abc".match(/(.*).*/)' > Regexp /(.*).*/ > 0 start_memory $1 > 1 anychar_repeat > 2 stop_memory $1 > 3 anychar_repeat > 4 end > subexpressions : 1 > Fastmap supplied : \000-\011\013-\377 > > String <> pos=0 > > 0 start_memory |abc | > 1 anychar_repeat |abc | >2[0] >2[1] >2[2] >2[3] F2[3] > 2 stop_memory abc| | $1=abc > 3 anychar_repeat abc| | >4[0] F4[0] SUCCESS > svg% > > What I want to say is that if the second .* can't match the empty string > because it's included in the first match, then the result will be > different. I wasn't aware that GNU or Oniguruma represented the empty string as a token, but it makes sense. I have made my engine sligthly different, where I have to do loop detection instead. -- Simon Strandgaard