Yeah, but if you are going to learn ruby & regexps, do it the ruby way
... don't use those UGLY perl $1 $2 match items... go OOP on it ...

 return /Event\#([0-9]+)/.match( host.text )[1]

j.

On 10/11/05, Bret Pettichord <[EMAIL PROTECTED]> wrote:
> At 04:23 PM 10/11/2005, beth ferguson wrote:
> >   Actually-- what i did was:
> >
> >    theText= $~ = host.contains_text(/Event\#
> >([0-9]+)([0-9]+)([0-9]+)([0-9])/)
> >     a = theText.to_s
> >     b = a.split(/\d/)
> >     b.push(a.sub(b[0],""))
> >     host.link(:text, "[Logout]").click
> >     return b[1]
> >
> >Returning the 2 item of the split as i know that's what I'll always want
> >in this instance
>
> I think this does what you want somewhat more simply:
>
>    host.contains_text /Event\#([0-9]+)/
>    return $1
>
> Note that host.contains_text is just a fancy wrapper around a match. This
> might be easier to understand:
>
>    host.text =~ /Event\#([0-9]+)/
>    return $1
>
> In fact, i'm thinking of deprecating contains_text in favor of this,
> because this just pushes you that much faster into learning Ruby regexps,
> which is a good thing.
>
> Bret
>
>
>
>
> _____________________
>   Bret Pettichord
>   www.pettichord.com
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>


--
"http://ruby-lang.org -- do you ruby?"

Jeff Wood

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to