From: Robert Klemme Date: 2010-02-22T17:13:54+09:00 Subject: [ruby-core:28290] [Bug #2778] Regular Expression Named Group Matching does not work with String#[] Bug #2778: Regular Expression Named Group Matching does not work with String#[] http://redmine.ruby-lang.org/issues/show/2778 Author: Robert Klemme Status: Open, Priority: Low Category: core ruby -v: ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-cygwin] I just noticed this: irb(main):001:0> s = "Robert Klemme" => "Robert Klemme" irb(main):002:0> s[/(?\w+)\s+\w+/, :first] TypeError: can't convert Symbol into Integer from (irb):2:in `[]' from (irb):2 from /opt/bin/irb19:12:in `
' irb(main):003:0> s.match(/(?\w+)\s+\w+/)[:first] => "Robert" IMHO it's just a small glitch but I believe for consistency reasons we should allow for a symbol as second argument with String#[] as well. ---------------------------------------- http://redmine.ruby-lang.org