P
Pranjal Jain
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
#~ if (matching == "u")
#~ puts "Who is Anant?"
#~ end
i +=1
end
"
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
#~ if (matching == "u")
#~ puts "Who is Anant?"
#~ end
i +=1
end
"