What does the regular expression mean?

Ask general questions here.
marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

What does the regular expression mean?

Post by marcushe » Tue Apr 28, 2009 7:23 am

I use Ranorex Spy to view applications , my application's path is

Base:/form[@title~'xxxx\AAAA\and\BBBB']

In regular expression ,to represent a blank space , by \s or \S.
Single char \ means changing its meaning.
I don't know what dows \ mean in Ranorex path here?
Are there some diffriences between standard regular expression and Ranorex regular expression?
BTW all attributes represented in path are in Ranorex Spy, right?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Apr 28, 2009 8:57 am

Ranorex uses the standard .NET Regular Expressions (see MSDN documentation of the Regex class). There are characters like the backslash that (standing alone or in combination) have a special meaning in a regular expression (please have a look on the regular expression language elements), like you stated the "\s" denotes a white-space character.
"\A" or "\B" do not have a special meaning; the paths generated by the Ranorex Recorder or Spy should not contain backslashes unless used for escaping the backslash itself or in front of a space "\ " (this is usually not needed, but the Regex.Escape method escapes white spaces anyway). So, if the path below is really generated by one of the Ranorex tools, please submit a bug report containing the exact Ranorex version!
marcushe wrote:BTW all attributes represented in path are in Ranorex Spy
Yes, you can use all the attributes you see in the General tab of RanorexSpy in RanoreXPaths.

Regards,
Alex
Ranorex Support Team

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Thanks and other problem

Post by marcushe » Tue Apr 28, 2009 9:45 am

My working Environment: Win7 , Ranorex2.02

There are some problem to modify rxpath on rxrepositry.
Assume default captured path is:
Base:/form[@title='My and Application' and @class='#32770' ]

I want to fix it as
Base:/form[@title~'*My and Application' and @class='#32770' and @enabled='True']

1.
when i deleted = and add ~'* ,then return
it doesn't change!!
Then i changed it as
Base:/form[@title~' *My and Application' and @class='#32770']

2.
When i add @enabled='True' to it and execute script ,this form can't be recognized.
if i add @enabled=True and return , word 'True' will miss

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue Apr 28, 2009 10:07 am

ad 1) Please note that '*My and Application' is not a valid regular expression! Do not confuse regular expressions with wildcards; '*' is a quantifier in regular expressions and matches the preceding element zero or more times. Please, read the MSDN documentation of regular expressions:
http://msdn.microsoft.com/en-us/library/az24scfc.aspx

ad 2) "@enabled='true'" should work, so please just use a small first letter.

Regards,
Alex
Ranorex Support Team

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Thanks!!!

Post by marcushe » Tue Apr 28, 2009 10:09 am

i make a mistake.