From: "Ara.T.Howard" Date: 2004-05-15T00:03:51+09:00 Subject: Re: Regexp Error? On Fri, 14 May 2004, Simon Strandgaard wrote: > On Fri, 14 May 2004 23:21:27 +0900 > ts wrote: > > > >>>>> "S" == Simon Strandgaard writes: > > > > S> ts wrote: > > S> [snip] > > >> What do you expect with ? > > >> > > >> /(.*).*/ =~ "abc" > > > > S> According to the left-most-longest rule.. I would guess the output > > S> should be ["abc", "abc"].. > > > > Then you have make .* match *twice* :-) > > > > If the regexp can't match the empty string in the second .* (because it's > > included in the first), it must not give a result > > I don't understand you here.. (maybe your assumption is wrong) ? 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. therefore we all agree that '123-456'.gsub /.*$/, 'X' => 'XX' because if it __didn't__ '(.*).*' could not match 'abc' -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 ===============================================================================