Regular Expression

Ranorex Studio, Spy, Recorder, and Driver.
NewLearner
Posts: 29
Joined: Wed Jan 15, 2014 3:32 pm

Regular Expression

Post by NewLearner » Wed Aug 13, 2014 2:29 pm

accessibledescription='dgo_ObjectID=#Ctrl1D.Pad.Row14

accessibledescription='dgo_ObjectID=#Ctrl1C.Pad.Row14

please let me know how to user regular expression for above statement, only different is statement 1 has D and statement 2 has C...pls let me know how to handle this using regular expression

Thank you

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

Re: Regular Expression

Post by krstcs » Wed Aug 13, 2014 2:38 pm

@accessibledescription~'dgo_ObjectID\=\#Ctrl1[C-D]D\.Pad\.Row14'

You need to escape all control characters ("=", "#", ".") using a backslash.

Also, notice the bracketed group "[C-D]". This tells regex to look for either capital C or capital D in the location of the "[...]". You can put whatever letters/numbers in there you want, for example if you need A-Z and a-z, then you would do it like this: "[a-zA-Z]".

Checkout this site for more info on Regex: http://www.regular-expressions.info/

It has lots of information and examples. Note that Ranorex is built on .NET, so it uses .NET Regex syntax, which is slightly different then JavaScript's (and others') Regex syntax.
Shortcuts usually aren't...