From: Joe Van Dyk Date: 2005-07-02T06:48:37+09:00 Subject: no clue I thought for all of five seconds for a good subject line for this question, but failed. Sorry! I have a string like: "some_key: blah, some_other_key: more_blah, yet_other_key: yet_more_blah" I want to build up a hash like { :some_key => "blah", :some_other_key => "more_blah", :yet_other_key => "yet_more_blah" } And I don't really want to have to know what the possible keys are in advance. So, the message format looks like: : , : How can I properly extract it out? Here's my initial attempt, which works, but seems hackish: attributes = message.split(",") attributes.each do |attribute| key, value = attribute.scan(/(\w+): (.+)/)[0] result_hash[key.to_sym] = value.strip end Also, this will get ran potentially thousands of times per second, so executation speed is of some concern.