It is now possible to use Regular Expressions in your selectors. Follow this guide to learn how!
What’s new?
We have added extra syntax to the Selector Editor to allow for advanced configuration of your selectors.
Let’s begin
As an example, I will be creating a selector that will be able to open a file whose name is dynamically changing.
Let’s assume I am receiving daily list of bills via email which are saved as a text file named ‘bills mmddyy.txt’, e.g ‘’bills 101019’. Now, I want to write an automation that uses one single selector which will recognize the file name, no matter the receiving date.
-
Assuming I have already downloaded the file on my computer, first I need to indicate the element I want to double click on to open it:
This results in the following selector:
-
Now, instead of the ‘text’ attribute absolute value, let’s use a regular expression that will match any string starting with ‘bills on’ and is followed by any numbers between 0 and 9. In addition, let’s instruct UiPath that the ‘text’ attribute is a regular expression and needs to be matched consequently, by adding the syntax:
matching:text='regex'
Like so:
-
When we press the Validate button, the selector should be valid and the button should turn to green:
-
When pressing the Highlight button, the correct element is going to be highlighted on the screen:
-
Now, let’s change the file name on disk to ‘bills on 101119’:
-
Going back to the Selector Editor window, and using the same selector using Regex, let’s press the ‘Validate’ button. The selector is also valid for the new file name and the Validate button remains green:
-
Pushing ‘Highlight’ button, it will highlight the new file name on the disk:
And this is how you tune your selectors to use regular expressions! The option can be used for almost any attribute, except that ones identifying the application executables like app=‘explorer.exe’ or app=’chrome.exe’
Also, it can be used for many attributes at the same time in same selector and, at any selector level you want!
That’s it for this #FeatureBlog
Please provide your valuable feedback about this feature! Our product team is hungry to build upon the basic functionalities so feed them your ideas
Don’t be shy, click on and tell us what you think or do it directly from Studio !
As always, thank you for reading and happy automating!