On Apr 19, 2012, at 3:00 PM, Loren wrote: > Hi, > > > I am new to ruby and to programming in general. > I am learning from an outdated book and just realized that the .grip > method can no longer be used on strings since ruby 1.9. > > My question is could you please recommend an alternative method that I > could use instead of grep and works on strings? ---- not sure that there was a 'grep' in any version of ruby but .include? tends to be useful
irb(main):001:0> test = "check" => "check" irb(main):002:0> string = "This is a string with a bunch of words which I can use to check" => "This is a string with a bunch of words which I can use to check" irb(main):003:0> string.include?(test) => true irb(main):004:0> test = "failure" => "failure" irb(main):005:0> string.include?(test) => false Craig -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

