------ art_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 <tomp / earthlink.net> wrote: > > > On Jan 29, 2007, at 5:25 PM, Wolfgang NáÅasi-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=Struct.new(:key, :value) => S irb(main):002:0> r=%r{(\w+)\s*=\s*(.*)} => /(\w+)\s*=\s*(.*)/ irb(main):003:0> m= r.match("name = Tom Pollard") => #<MatchData:0xb7dfbb5c> irb(main):004:0> s=S.new(*m.captures) => #<struct S key="name", value="Tom Pollard"> irb(main):005:0> s.key => "name" irb(main):006:0> s.value => "Tom Pollard" this could easily be wrapped into a class BTW. HTH Robert -- 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 ------ art_36797_11772652.1170519805739--