On 8/15/06, Paul Carvalho <[EMAIL PROTECTED]> wrote: > Hi there, I'm still a novice when it comes to using regular expressions and > am having a bit of difficulty figuring out the syntax on the following > problem. > > Here's what I want to do: > - I'm trying to create a branch in the code if the PageHeadingLabel contains > one of two words. > > Here's the line that I've tried: > if t_ie.span(:id, /PageHeadingLabel/).text.include?( > /Create|Update/ ) > > This doesn't work. When I try it in IRB, I see the following message: > --- > TypeError: can't convert Regexp into String > from (irb):7:in `include?' > from (irb):7 > from :0 > --- > > Suggestions? I really didn't want to use two comparisons, one for each > word. There must be an efficient way to do this, yes?
Yep, use the String#match method. http://www.ruby-doc.org/core/classes/String.html#M000583 The String#include? method does not handle Regexps. http://www.ruby-doc.org/core/classes/String.html#M000616 _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
