How to determine the position of a known Word inside a User generated string

Hi all,

I guess the Topic name is a little confusing but let me describe my problem:
I Am currently building an attended search Robot.
The User can Enter any String they want containing conectors “AND” “OR” “NOT”

based on the position and value of the Conector in the string for example:

Apples AND Tomatos OR Cucumbers NOT Bread

i want to identify what is the connector and wehre it´s position is and based on this the Robot should move on going different paths.

i tried using the .contain function:

Mystr.contains(“AND”)

but i am not able to determine the of the conector

I am rather new to the RPA so i am not really aware if there is even a better option for this problem.

Could work around with a select function
I found a different forum entry mentoning this for Selecting Words in capital letters with 3 characters:

Use System.Text.RegularExpressions.Regex.Matches(MyStr, "[A-Z]{3}") , where MyStr is the string on which you’re searching.

could you rewrite this function to something like: System.Text.RegularExpressions.Regex.Matches(MyStr, “AND”, “OR”, “NOT”)` assign every item to an array and based on the items value continue?

Thank you for your help

1 Like

Hi,

Can you try the following sample?

Main.xaml (14.3 KB)

Regards,

1 Like

Hi @Yoichi

Thank you for your response, unfortunatly i am not able to see the last two activities.
grafik

Am i missing an additional packag here?
Thank you in advance

Try using Manage Dependencies to rebuild those packages in your project.

2 Likes

Hi,

Can you upgrade your UiPath.System.Activities Package to 20.4.1?

Regards,

1 Like