Handling Regexp through Perl

45 views
Skip to first unread message

Kalyan

unread,
Aug 16, 2011, 2:13:49 PM8/16/11
to Selenium - Automated Software Testing, ch.ka...@gmail.com
Hello All,

I am facing some issues with the Regular Expression in selenium with
perl. Here is the command

example :

Var[1] = sel->text_is_ok("XPATH to the location", "String.
(9343413-23432ASD121)");

From the above line the number which is in () will change based on the
device. Again 9343413 is constant but the value after the '-' will
change based on device. Now I need to add a reg exp to the above
statement ? Any ideas ??

I tried passing different values in " ". When i pass them in doubt
quotes it's taking the regexp as string. If i pass the values without
double quotes it's giving undef error message while executing the
statements.

Vinaykumar Patel

unread,
Aug 17, 2011, 12:55:42 AM8/17/11
to selenium-...@googlegroups.com
Hi,
RegExp can only verify if the patter is in specific format. It can not generate a patter which someone else is verifying (in your case command text_is_ok is verifying the patter and it does not support regexp). Though, i am not sure about your problem, but you may try this.

my $str = "9343413-".random(); # random is user defined function which will generate the values you want.
Var[1] = sel->text_is_ok("XPATH to the location", "String.($str)");


-Vinay



--
You received this message because you are subscribed to the Google Groups "Selenium - Automated Software Testing" group.
To post to this group, send email to selenium-...@googlegroups.com.
To unsubscribe from this group, send email to selenium-test-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-test-tool?hl=en.


Reply all
Reply to author
Forward
0 new messages