From: "rkh (Konstantin Haase)" Date: 2013-04-29T02:45:16+09:00 Subject: [ruby-core:54674] [CommonRuby - Feature #8343] StringScanner#[] should accept names of named captures Issue #8343 has been updated by rkh (Konstantin Haase). On a related note: should the patch be submitted in a second issue on the ruby-trunk project? ---------------------------------------- Feature #8343: StringScanner#[] should accept names of named captures https://bugs.ruby-lang.org/issues/8343#change-39016 Author: rkh (Konstantin Haase) Status: Open Priority: Normal Assignee: Category: Target version: Example: s = StringScanner.new("Fri Dec 12 1975 14:39") s.scan(/(?\w+) (?\w+) (?\d+) /) # this currently works s[0] # -> "Fri Dec 12 " s[1] # -> "Fri" s[2] # -> "Dec" s[3] # -> "12" # this currently does not work s[:wday] # -> "Fri" s[:month] # -> "Dec" s[:day] # -> "12" I attached a patch including tests for MRI, I don't know if Rubinius has a different implementation, I guess JRuby has. I can look into this if the feature gets accepted. -- http://bugs.ruby-lang.org/