From: "Ara.T.Howard" Date: 2004-05-15T01:53:56+09:00 Subject: Re: Regexp Error? On Fri, 14 May 2004, Kristof Bastiaensen wrote: > 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 but then /^$/ would not match '' empty tokens must not consume and must stack -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================