From: trans Date: 2012-03-18T21:31:50+09:00 Subject: [ruby-core:43446] [ruby-trunk - Feature #1873] MatchData#[]: Omits All But Last Captures Corresponding to the Same Named Group Issue #1873 has been updated by trans. This is the first time I've seen regular expression groups, so it's interesting. It occurs to me that with this addition MatchData is both a sort of Array and a sort of Hash. That being so consider `md.to_h`. ---------------------------------------- Feature #1873: MatchData#[]: Omits All But Last Captures Corresponding to the Same Named Group https://bugs.ruby-lang.org/issues/1873#change-24913 Author: runpaint Status: Feedback Priority: Normal Assignee: naruse Category: core Target version: 2.0.0 =begin I suspect that MatchData#[:symbol] should return an Array of values when the same named group has been matched multiple times. >> m = 'food'.match(/(?oo)(?d)/) => # >> m[:f] => "d" >> m.to_a => ["ood", "oo", "d"] =end -- http://bugs.ruby-lang.org/