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

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.

  1. 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:

    image

    This results in the following selector:

    image

  2. 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:

  3. When we press the Validate button, the selector should be valid and the button should turn to green:

  4. When pressing the Highlight button, the correct element is going to be highlighted on the screen:

    image

  5. Now, let’s change the file name on disk to ‘bills on 101119’:

    image

  6. 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:

  7. Pushing ‘Highlight’ button, it will highlight the new file name on the disk:

    image

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 :slight_smile:

Don’t be shy, click on image and tell us what you think or do it directly from Studio image !
As always, thank you for reading and happy automating!

26 Likes

Wow its really awesome:heart_eyes:

2 Likes

Great feature.

1 Like

Wow! nice informative info. @loginerror

cheers

3 Likes

The fact of making selectors more flexible is really helpful, I was waiting on this one!
Thanks :smiley:

1 Like

Very nice feature… :smile:

So much new features that I cannot follow them all trough :smiley:

Nice feature:star_struck:

1 Like

Thanks for sharing… this is quite useful. can you pleae point to documentation of regex that one can use.

Hi @sanjeev.sapre

You can start your regex journey by trying it out on a website like regex101.com

2 Likes

It is a great feature for my part, because I like to use regex everywhere.
Thanks so much for your introduction.
By the way, since matching:text can be set a value,
I wonder if there are another features when it be set a value other than ‘regex’.

Nice feature @loginerror, but it lacks the ability to use Regex Options, like case insensitive.
I have tried to use case insensitive within my expression and it didn’t work. I am using version 19.10.1 of UiAutomation package.

@wusiyangjia, yes, you can set matching:text=fuzzy and do a fuzzy search for that attribute

1 Like

@danielcraciun, case insensitive support comes soon. Stay tuned :wink:

4 Likes

its really awesome feature…

Hi @gheorghestan, what about the case insensitive support? It would be great :wink:
Do you have a turnaround about it?

Thanks!

@Anthony_LC this is out there for you to try it out since few weeks ago: UIAutomation.Activities.20.2 Preview

check this out: 2020 Fast Track: Preview 2 Release

1 Like

Hi,

How can I use this in browser? Can someone help me?

Nice information. :+1: