[ruby-core:114031] [Ruby master Bug#19746] `String#index` with regexp and too large offset doesn't clear `$~`

Issue #19746 has been reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Bug #19746: `String#index` with regexp and too large offset doesn't clear `$~` https://bugs.ruby-lang.org/issues/19746 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED ---------------------------------------- ```ruby /./ =~ "a" p "x".index(/0/, 4) #=> nil p $~ #=> #<MatchData "a"> ``` while `rindex` does. ```ruby /./ =~ "a" p "x".rindex(/0/, 4) #=> nil p $~ #=> nil ``` It seems since 1.9. -- https://bugs.ruby-lang.org/

Issue #19746 has been updated by nagachika (Tomoyuki Chikanaga). 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. ---------------------------------------- Bug #19746: `String#index` with regexp and too large offset doesn't clear `$~` https://bugs.ruby-lang.org/issues/19746#change-103954 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * Backport: 3.0: REQUIRED, 3.1: REQUIRED, 3.2: WONTFIX ---------------------------------------- ```ruby /./ =~ "a" p "x".index(/0/, 4) #=> nil p $~ #=> #<MatchData "a"> ``` while `rindex` does. ```ruby /./ =~ "a" p "x".rindex(/0/, 4) #=> nil p $~ #=> nil ``` It seems since 1.9. -- https://bugs.ruby-lang.org/
participants (2)
-
nagachika (Tomoyuki Chikanaga)
-
nobu (Nobuyoshi Nakada)