From: lasitha Date: 2009-02-21T03:51:07+09:00 Subject: Re: String#include? with several possibilities? On Fri, Feb 20, 2009 at 11:54 PM, Aldric Giacomoni <"aldric[remove]"@trevoke.net> wrote: > Say I have a string like.. At random... > string = "The quick brown fox jumps over the lazy dog" > I'd like to do something like: > puts "Yes!" if string.include? ('quick', 'brown', 'lazy') > Expected behavior : if -any- of them are included, return true. > > Is that possible with a built-in method? $: irb 01> s = "The quick brown fox jumps over the lazy dog" --> "The quick brown fox jumps over the lazy dog" 02> s =~ /(quick|brown|fox)/ --> 4 03> s =~ /(not|this|nor|that)/ --> nil Cheers, lasitha.