From: matz@... (Yukihiro Matsumoto) Date: 2000-02-10T02:11:41+09:00 Subject: [ruby-talk:01282] Re: Buggette in String Hi, In message "[ruby-talk:01277] Buggette in String" on 00/02/09, Dave Thomas writes: | ruby -e 'p "hello".index(/l/, -3)' # -> nil | ruby -e 'p "hello".index("l", -3)' # -> 2 Oops, String#index did not support negative offset. |I suspect string.c:568 should change from | | pos = rb_reg_adjust_startpos(sub, str, pos, 0); I added the following code right before `switch' (l.564). if (pos < 0) { pos += RSTRING(str)->len; if (pos < 0) return Qnil; } |but knowing for sure would mean understanding the regexp setup code, |and I only have one life ;-) Pretty complicated, isn't it? matz. p.s. I have two lives, life as a programmer and life as a father/husband. :-)