Zangief Ief wrote:
> Hi,
> 
> I am able to know if there is a substring in a string with:
> 
> if string =~ /#{word}/:
>   puts "match"
> else
>   puts "do not match"
> end
> 
> But I would like to count all the substring from a string...
> 
> Thanks for help :)

irb(main):001:0> "one word is one word, never be three 
words".scan(/word/).length
=> 3

:-), Wolfgang N√°dasi-Donner
-- 
Posted via http://www.ruby-forum.com/.