Project

General

Profile

Actions

Bug #13716

closed

Unexpected or undocumented (or maybe both) behaviour when mixing String#scan with named captures

Added by shyouhei (Shyouhei Urabe) over 6 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.0dev (2017-06-22 trunk 59146) [x86_64-darwin15]
[ruby-core:81913]

Description

Is this intentional?

[1] pry(main)> "1q2w3e4r".scan(/(\w\d)(foo){0}/)
=> [["q2", nil], ["w3", nil], ["e4", nil]]
[2] pry(main)> "1q2w3e4r".scan(/(\w\d)(?<foo>foo){0}/)
=> [[nil], [nil], [nil]]

The only difference is the capture being named.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0