Regular Expression

Ask general questions here.
NewLearner
Posts: 29
Joined: Wed Jan 15, 2014 3:32 pm

Regular Expression

Post by NewLearner » Wed Jan 14, 2015 4:13 pm

//cell[@Accname=' 0006000 User 14/01/2015 15:03 109']

please let me know how to handle this in regular expression, date and time keep changing and 109 is the order number this also keep change...but order number stored in module variable $orderNumber.


Thanks in Advance

NewLearner
Posts: 29
Joined: Wed Jan 15, 2014 3:32 pm

Re: Regular Expression

Post by NewLearner » Wed Jan 14, 2015 4:15 pm

//cell[@Accname=' 0006000 User 14/01/2015 15:03 109']

please let me know how to handle this in regular expression, date and time keep changing and 109 is the order number this also keep change...but order number stored in module variable $orderNumber.

Validation in mainly for ordernumber....what ever time stamp is ok

Thanks in Advance

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Regular Expression

Post by krstcs » Wed Jan 14, 2015 4:50 pm

How about variablizing the order number and using regex for the rest, like this:

Code: Select all

//cell[@Accname~' 0006000 User .* .* ' + $orderNumber]
Since you don't care about the date, you can use the ".*" notation to say "anything can be in this location".

Just remember to only replace the date and time strings with the .* as it doesn't always work right with whitespace.

You could also do the full regex pattern for the date and time:

Code: Select all

//cell[@Accname~' 0006000 User [0-3][0-9]/[0-1][0-9]/[0-9][0-9][0-9][0-9] [0-2][0-9]\:[0-5][0-9] ' + $orderNumber]
Shortcuts usually aren't...