Actions
Bug #19746
closed`String#index` with regexp and too large offset doesn't clear `$~`
Description
/./ =~ "a"
p "x".index(/0/, 4) #=> nil
p $~ #=> #<MatchData "a">
while rindex
does.
/./ =~ "a"
p "x".rindex(/0/, 4) #=> nil
p $~ #=> nil
It seems since 1.9.
Updated by nobu (Nobuyoshi Nakada) over 1 year ago
- Status changed from Open to Closed
Applied in changeset git|0cbfeb8210cd177bee95c512834c483daec36f74.
[Bug #19746] String#index
with regexp should clear $~
unless matched
Updated by nagachika (Tomoyuki Chikanaga) over 1 year ago
- Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: WONTFIX
I cannot confident that there's no existing application depends on the current behavior.
I don't backport the changeset.
Actions
Like1
Like0Like0