Yukihiro Matsumoto
12/28/2004 4:23:00 AM
Hi,
In message "Re: rindex with regexp"
on Tue, 28 Dec 2004 13:09:58 +0900, "trans. (T. Onoma)" <transami@runbox.com> writes:
|Using rindex with a regexp would appear to undermine greediness.
|
|irb(main):012:0> "a--b--c".rindex(/[-]+/)
|=> 5
|irb(main):013:0> p $~.begin(0)
|5
|I would expect the 5 to be a 4.
rindex is as lazy as me not to seek longest match.
matz.