Issue #13135 has been reported by Shugo Maeda.

----------------------------------------
Bug #13135: Regexp.last_match returns nil with s.rindex(//)
https://bugs.ruby-lang.org/issues/13135

* Author: Shugo Maeda
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
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
#<MatchData "">
```

Is this intended behavior?




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>