From: Tim Hunter Date: 2008-07-07T07:00:26+09:00 Subject: Re: .include? for string Chris Chris wrote: > Hi, > > I have an array a > > => [["abc", "def", "ghi|ghi|kl"], ["jkl", "mno", "ghi|pqr"], ["stu", > "vwx", "yz|abc"]] > > Some strings contain the pipe character. > > I want to delete all the arrows that do NOT contain a certain string. > > I tried this: > > a.delete_if { |x| !x.include? "ghi|ghi" } > > => [] > > Of course, the array I need would be > => [["abc", "def", "ghi|ghi|kl"]] > > > I couldn't figure out a work around. Any wildcards available for string > checking in Ruby? Any ideas? > Thanks. > > Cheers, > Chris Try a['|'] That will return nil if the string does not contain the pipe. -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html