[wtr-general] Re: How can I use a variable in the following $ie.div(:text,/variable_name/)

2009-01-22 Thread Bret Pettichord
Andy Sipe wrote: > You can also use interpolation to do it shorter: > > myvar = > puts $ie.div(:text, /#{myvar}/) > > In either case, any regex reserved character will either have to be > stripped or escaped to avoid out right errors like with the ( or weird > matches. > > Some of those cha

[wtr-general] Re: How can I use a variable in the following $ie.div(:text,/variable_name/)

2009-01-21 Thread Darin Duphorn
Thanks, Very helpful. DD From: watir-general@googlegroups.com [mailto:watir-gene...@googlegroups.com] On Behalf Of Andy Sipe Sent: Wednesday, January 21, 2009 12:07 PM To: watir-general@googlegroups.com Subject: [wtr-general] Re: How can I use a

[wtr-general] Re: How can I use a variable in the following $ie.div(:text,/variable_name/)

2009-01-21 Thread Andy Sipe
You can also use interpolation to do it shorter: myvar = puts $ie.div(:text, /#{myvar}/) In either case, any regex reserved character will either have to be stripped or escaped to avoid out right errors like with the ( or weird matches. Some of those characters are:( ) [ ] * . - ^ $ Th

[wtr-general] Re: How can I use a variable in the following $ie.div(:text,/variable_name/)

2009-01-21 Thread Moochie
I got it. if message.index("*") != nil myvar = message[0,message.index("*")].to_s regxmyvar = Regexp.new myvar puts $ie.div(:text,regxmyvar) end It failed if If my string end with '(' so I'm guessing special characters have to be substituted. On Jan 21, 11:37 am, Moochie wrote: