From: Robert Dober Date: 2007-02-04T01:23:28+09:00 Subject: Re: Named groups in regexp matches? ------=_Part_36797_11772652.1170519805739 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 1/30/07, Tom Pollard wrote: > > > On Jan 29, 2007, at 5:25 PM, Wolfgang N=E1dasi-Donner wrote: > > Summary - in the near future you will habe a lot of powerful new > > features in > > Ruby's pattern matching facilities. > > Thanks very much that report! Now I'll just have to decide whether > to wait until 1.9 rolls out, or find some other way to port my code > in the meantime. > > Tom > What I do might be enough for your purpose S=3DStruct.new(:key, :value) =3D> S irb(main):002:0> r=3D%r{(\w+)\s*=3D\s*(.*)} =3D> /(\w+)\s*=3D\s*(.*)/ irb(main):003:0> m=3D r.match("name =3D Tom Pollard") =3D> # irb(main):004:0> s=3DS.new(*m.captures) =3D> # irb(main):005:0> s.key =3D> "name" irb(main):006:0> s.value =3D> "Tom Pollard" this could easily be wrapped into a class BTW. HTH Robert --=20 We have not succeeded in answering all of our questions. In fact, in some ways, we are more confused than ever. But we feel we are confused on a higher level and about more important things. -Anonymous ------=_Part_36797_11772652.1170519805739--