#FeatureBlog - 19.10 - Using regular expression (Regex) in the selector attributes

@AndyMenon , if it is working for you, please click on solution button.

Regards,
Nirmalya Sarkar.

Hi @loginerror,

Quite late to the party, but this is extactly what I was looking for. RegexSearch within selectors. BluePrism had this feature long ago so its nice to see UiPath support it too.

The windows popup in different languages is different. By using the following alteration to the selector we avoided drastic changes to the code!

If anyone else is facing the same issue, only a | is required to support multiple languages.

<wnd app='chrome.exe' cls='#32770'  title='Open|Åpne' matching:title='regex'  />
<wnd ctrlid='1148' />
4 Likes

Hi @loginerror

Can we add flags to the regular expression?

Thanks In Advance

Hi @Rohan_Tammewar

So far, we only support the case sensitivity flag. Can you please describe your use case and what RegEx flags would you consider useful?

Thanks,
Iulian Mircea

Can you please share us the full workflow so that beginners like me can learn.

Thanks
Someswaran

Hi @iulian.mircea

The case was related to the multiline, single line and case sensitive flags. I have checked the case sensitivity flag link but not sure how to use it in selector, an eg could be of great help.

Thanks,
Rohan Tammewar

Hi all,

Thanks for sharing your feedback and suggestions for improvement!

Regarding case-insensitive RegEx matching, here is an example of how to use it for "innertext" webctrl attribute:

<html app='chrome.exe' title='HTML Tutorial' url='https://www.w3schools.com/html/default.asp' />
<webctrl tag='H1' innertext='.*html.*tutorial.*' matching:innertext='regex' casesensitive:innertext='false' />

This selector will match an H1 element with text "HTML Tutorial". If you switch casesesnsitive:innertext to true, it won’t match anymore.

Regarding singleline and multiline support, we don’t have it at the moment, but usually there are alternative ways to design Regular Expressions which work around this limitation. Can you please share a use case for singleline or multiline RegEx, so we can look for such a workaround?

Best regards,
Iulian

2 Likes