Regular Expression on DIV TAG

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
Posts: 72
Joined: Thu Jun 24, 2010 8:59 am

Regular Expression on DIV TAG

Post by dal » Tue Oct 12, 2010 9:30 am


We have some objects RxPath starts with the following:


I know how to use RegEx for this (div[@id='00_Home']/) DIV TAG.

How can I do for div[2]/

Since there are cases, other RxPath is similar in few objects in my application, only this is changing, is there a way to do like this -- div[2|3|4]/ OR div[0-9]/, but its not been accepted by the Tool.


User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Regular Expression on DIV TAG

Post by Support Team » Tue Oct 12, 2010 10:37 am


the RegExps evaluation only works for comparisions on attributes. But you can use the attribute child index for your objects. The only thing to be carefull with is the fact, that the attribute childindex starts at '0' not at '1' as in the array-style notation you tried to use. So for div[2]/ you have to write div[@childindex='1']/.


Ranorex Team

Posts: 2
Joined: Thu Jan 16, 2014 4:50 pm

Re: Regular Expression on DIV TAG

Post by midocap » Fri Jan 17, 2014 12:07 pm

but the issue if i use the Childindex the project didn't run do you know what is the soultion


Re: Regular Expression on DIV TAG

Post by mebner » Mon Jan 20, 2014 1:49 pm


May I ask you to send us more information about the issue?
Where do you use the childindex, for which element and what exactly didn't run?
Do you get an exception when you run the solution?
If yes, could you send us the message?


Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Regular Expression on DIV TAG

Post by mzperix » Wed Mar 12, 2014 3:18 pm

If there is only one div with @id='00_Home' attribute, then you could just delete the index like this:



Ranorex will now go and search the elements on the body/form/div/div path, and gives the first catch, that has the attribute @id='00_Home'

Hope this helps :)