From: 7stud -- Date: 2011-04-24T07:57:06+09:00 Subject: Re: How to split dot “.” only before equal “=” Sira PS wrote in post #994664: > 7stud, > > actually i need to split dot before equal sign except after equal sign > > the values i need are > > Project > risksPotentialAfterSum > Pot. aft. > > can i split it the get these result in the same time? str = 'projects.risks.Index.flash_downloading=Downloading.test' pieces = str.split(/=/) more_pieces = pieces[0].split(/[.]/) data = more_pieces << pieces[1] data.each_slice(2) do |arr| k, v = arr if v.nil? puts "#{k} => nil" end end -- Posted via http://www.ruby-forum.com/.