From: Yusuf Celik Date: 2007-04-19T23:34:39+09:00 Subject: Re: How to count a word in a line Thanks David, What can I say I am speechless. Just 1 line wow. Thanks anyway Yusuf > You could do: > > line.scan(/\bHi\b/).size > > (or \s instead of \b if you want it to be spaces instead of word > boundaries [which can also be hyphens and other punctuation]). -- Posted via http://www.ruby-forum.com/.