From: Kenneth McDonald Date: 2008-09-09T02:38:38+09:00 Subject: Re: Oniguruma question I'm writing a library to make re's easier to use :-) This is in the test suite. Thanks for the feedback, that comes as a real surprise to me. So maybe I'll try /..+?/ Cheers, Ken On Sep 8, 2008, at 9:34 AM, Robert Klemme wrote: > 2008/9/8 Kenneth McDonald : >> For those adventurous souls who are already using Oniguruma... >> >> With the following Oniguruma re: >> >> print "aabb".index(/.+?(?> print "\n" >> >> My reasoning tells me I should be getting 3, but I'm getting 0. >> Basically, >> the .+ should force the re 'cursor' past at least the first a; >> after that, >> the negative lookback should force it past the first b. Could someone >> explain where I'm misunderstanding? > > Your reasoning about ".+" is wrong. Non greedy matching does only mean > that the /end point/ of a match might be moved to the left, but never > the /start point/ be moved to the right. So .+ matches directly at > the beginning of the string. > > Any practical problem that you're trying to solve (and we can try to > tackle)? :-) > > Kind regards > > robert > > > -- > use.inject do |as, often| as.you_can - without end >