From: Robert Klemme Date: 2008-09-08T23:34:22+09:00 Subject: Re: Oniguruma question 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