From: dblack@... Date: 2006-04-27T02:21:22+09:00 Subject: Re: How i can to parse string Hi -- On Wed, 26 Apr 2006, Kroeger, Simon (ext) wrote: > >> [..] >> But... but... neither of you guys's version gives the same result as >> Jonh's :-) >> >> I think this does: >> >> Hash[*str.scan(/([^,]+)=([^,]+)/).flatten] >> >> >> David >> > > or > > Hash[*str.split(/=|,/)] Oh, right -- or that :-) Another demonstration of the principle that as one works on Ruby code it evaporates from the screen, *and* becomes clearer rather than more cryptic. David -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" PDF now on sale! http://www.manning.com/black Paper version coming in early May!