From: "Wesley J. Landaker" Date: 2003-08-27T04:55:19+09:00 Subject: Re: Named matches for regular expressions (was: Re: Specification of Ruby regex?) Apparently, Austin Ziegler recently wrote: > On Wed, 27 Aug 2003 04:29:22 +0900, Wesley J. Landaker wrote: >> Apparently, Austin Ziegler recently wrote: >>> On Tue, 26 Aug 2003 21:28:07 +0900, Gavin Sinclair wrote: >>>> On Tuesday, August 26, 2003, 10:18:24 PM, Emmanuel wrote: >>>>> btw, since there is a thread about that, i wanted to ask: does ruby >>>>> support named matches (sorry i don't know the proper terminology)? >>>> I'm 99.99% sure it doesn't. >>> The latest Oniguruma supports it. I'm not sure how to use/enable that, >>> but it does support it. > > No. See [ruby-talk:79047] and following. > > ----------- > [ruby-dev:21147] [Oniguruma] list of all captures > [ruby-dev:21174] [Oniguruma] Version 1.9.2 > > TANAKA Akira suggested a new function, to capture all matchings for > the one expression. e.g. > > m = /(?@\/\w+)+/.match("/usr/local/bin/ruby") > p m['name'] #=> ["/usr", "/local", "/bin", "/ruby"] > ----------- Well, that is useful too, but quite different from what the OP asked for (their example was a regex from C# with named grouping) -- you can do that easily in Ruby, as I just demonstrated. =) If Oniguruma does that also, then that is great! (I haven't looked at Oniguruma and don't really know what it is.) Wes