From: Pranjal Jain Date: 2008-04-26T18:00:54+09:00 Subject: Split a sentence by regular expression Hi I want to split a sentence by means of regular expression. For example, the sentence is " Hello how r u?" How can i split this ? the way I used is as follows : " matching = Array.new a = gets puts a.split.length re = /((\w+)\s)+/ matching = re.match(a) i = 1 until i >a.split.length puts i puts matching[i] #~ if (matching[i] == "u") #~ puts "Who is Anant?" #~ end i +=1 end " -- Posted via http://www.ruby-forum.com/.