Regular Expression for identifying selector

I have following selector where the part of attribute parentid changes for each iteration to a different number only (parentid=‘th-ce-block-117’ , parentid=‘th-ce-block-187’, parentid=‘th-ce-block-105’).

<webctrl id='draftEditorWindow' tag='IFRAME' />
<webctrl aaname='[#Required_Text#]' parentid='th-ce-block-117' tag='SPAN' />

I tried using the new regex feature in selector. But the Uiexplorer is not able to identify the element

<webctrl id='draftEditorWindow' tag='IFRAME' />
<webctrl aaname='[#Required_Text#]' parentid='th-ce-block-.*[\d*]' tag='SPAN' matching:parentid='regex' />

I validated my regex https://regex101.com/r/eZ1gT7/5 here and it works. Is there something I need to do to get this element identified in selector ?

Have you tested without regex?

<webctrl aaname='[#Required_Text#]' parentid='th-ce-block-*' tag='SPAN' />

You regex pattern requires that the parentid ends with either a digit or an asterisk. It should work fine as long there’s a digit at the end. Are there maybe any characters after the digits? Like for example: parentid='th-ce-block-117 '

1 Like

Thanks ptrobot for replying. I did try * with no success. Then I started looking for alternatives and tried both fuzzy search and regex which are new features in 19.10 the version I am using. The parent Id always ends with a number that’s why I used that pattern.

Hi,

<webctrl aaname='[#Required_Text#]' parentid='th-ce-block-.*[\d*]' tag='SPAN' matching:parentid='regex' />

Your regex pattern .*[\d*] will match any characters after th-ce-block-.
If you want to match only digit, can you try the following expression?

<webctrl aaname='[#Required_Text#]' parentid='th-ce-block-\d+' tag='SPAN' matching:parentid='regex' />

Regards,

parentid='th-ce-block-*' (without regex) should match any parentid that starts with “th-ce-block-”. Does that part also changes somehow? Could you run your workflow and show us a screenshot of the error? (UiPath should show a list of the closest matches).