From: naruse@... Date: 2017-03-11T17:35:30+00:00 Subject: [ruby-core:80034] [Ruby trunk Bug#13135] Regexp.last_match returns nil with s.rindex(//) Issue #13135 has been updated by Yui NARUSE. Backport changed from 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN to 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: DONE ruby_2_4 r57864 merged revision(s) 57374. ---------------------------------------- Bug #13135: Regexp.last_match returns nil with s.rindex(//) https://bugs.ruby-lang.org/issues/13135#change-63456 * Author: Shugo Maeda * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: DONE ---------------------------------------- Regexp.last_match returns nil, if // is given to String#rindex: ``` lexington:ruby$ ruby -ve 'p "foo".rindex(//); p Regexp.last_match' ruby 2.5.0dev (2017-01-17 trunk 57359) [x86_64-linux] 3 nil ``` while it returns a MatchData with String#index: ``` lexington:ruby$ ruby -ve 'p "foo".index(//); p Regexp.last_match' ruby 2.5.0dev (2017-01-17 trunk 57359) [x86_64-linux] 0 # ``` Is this intended behavior? -- https://bugs.ruby-lang.org/ Unsubscribe: