How to write regex expression on selector for OR expression

Hi All

I am trying to extract data on a webpage to fill up my database. I need UIpath to select the correct name and click it. The correct name is either “bulk carrier” “or ex vessel”. May i know what is wrong with my selector using regex?

[selector editor]

image

Hi @exiang

Instead of regex you can do it based on array

StrText=Split("".ToCharArray)
and print the values within for each item

Thanks
Ashwin S

Hi,

Can you try the following?

<webctl matching:aaname='regex' aaname='^bulk.*|.*ex.*' parentid='app' tag='SPAN' />

Please note regex in selector is Case Sensitive.

Regards,

Hi Yoichi

Nope. the error msg is syntax error in the selector. I changed the first font to capital letter.

How do i write “Bulk Carrier” or “Ex Vessel” on the selector?

Hi,

How about the following?

<webctl matching:aaname='regex' aaname='(Bulk Carrier)|(Ex Vessel)' parentid='app' tag='SPAN' />

In my environment, there is no syntax error.
It might depend on UiAutomation.Activity Package. Which version do you use?

Regards,

Hi Yoichi

I upgraded to 19.12.0-preview. However, it is still showing syntax error. I attached my file for your check. Many thanks for your help.

extractvesselname.xaml (10.0 KB)

Hi,

Thank you for sharing your workflow.
I just reproduced your problem and I found it causeed my typo for webctrl. (Sorry)

Can you try the following?

<webctrl matching:aaname='regex' aaname='(Bulk Carrier)|(Ex Vessel)' parentid='app' tag='SPAN' />

Regards,

thank you v much. It works! I managed to used

Just for my knowledge in regex:

.* means “zero or more of any character"?

1 Like

Hi,

That’s good to hear.

. means any character except line break.
* means 0 or more.
So, .* means zero or more of any character except line break.

Regards,

Hi,
I am trying to use regex for my selector. but it is not working. could you please help me with the below regex for selector.

I tired the above regex but both are not validating.

Please find the attached images for reference.
image


Both will work if I click on the object in different navigation method.