From: Robert Klemme Date: 2006-04-27T19:56:23+09:00 Subject: Re: I have some problem with convert to symbol, in Hash object 2006/4/27, John : > I use it functionality: > > >> Hash[*str.scan(/store\[([^\s,]+)\s*\]=\s*([^,]+)/).flatten] > => {"fax"=>"80233923293", "name"=>"Ilyas store", > "description"=>"lkjklsdaj", "phone"=>"4999-233-2923"} > The problem with covert string to symbol. > > I want to convert "name" to :symbol > "name"=>"Ilyas store" ---> :name => "Ilyas store" Difficult to test without the original string but try something like this: Hash[*str.scan(/store\[([^\s,]+)\s*\]=\s*([^,]+)/).map{|k, v| [k.to_sym,v]}.flatten] Kind regards robert