From: Kristof Bastiaensen Date: 2004-05-15T01:18:52+09:00 Subject: Re: Regexp Error? On Fri, 14 May 2004 08:54:22 -0600, Ara.T.Howard wrote: > > what guy is saying here is that __unless__ both '(.*)' __and__ '.*' match in > the above - you don't have match. we all agree that the '(.*)' matches the > entire 'abc' and we all agree that the pattern '(.*).*' matches 'abc' - > therefore we all agree that it's correct that certain pattern match zero width > positions in strings and consume no chars whilst still matching. Agree until here. > therefore we > all agree that > > '123-456'.gsub /.*$/, 'X' => 'XX' > > because if it __didn't__ '(.*).*' could not match 'abc' > > > -a I don't agree. The things is, you can't really consume 'nothing'. If I follow your reasoning, the above should give 'XXX', because 123-456 matches /(.*)(.*)(.*)/. How much empty spaces are there between two characters? One, three, infinite? There have to be rules, and I would find the following the most logical one: * when the empty space is already matched before, don't match again, unless explicitly against ? or *. (gawk behaviour?) Kristof