Hi,

In message "[ruby-talk:01277] Buggette in String"
    on 00/02/09, Dave Thomas <Dave / thomases.com> 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. :-)