From: Giampiero Zanchi Date: 2009-02-12T18:54:31+09:00 Subject: Re: Method to get string combinations William's code is amazing! A one line solution, inspired by his ideas: "This {is|was} a {good|nice} day".split(/\{(.*?)\}/).map! {|x| x.split("|")}.inject([[]]){|old,lst| lst.inject([]){|new,e| new + old.map{|c| c + [ e ] }}}.each {|x| p x.join} -- Posted via http://www.ruby-forum.com/.