W.r.t try catch, could you help me on if the expression contains special characters then is to perform a click operation…else the output in the message box…!

Scenario:

Steps to reproduce:

Current Behavior:

Expected Behavior:

Studio/Robot/Orchestrator Version:

Last stable behavior:
Last stable version:
OS Version:
Others if Relevant: (workflow, logs, .net version, service pack, etc):

Please try to be clear. Also, if you did not graduate the academy please post in Rookies.

Hi,

By the sounds of it you are looking to only match special characters (things like ! or $) in a string and then perform a click action if found?

We can use regex for this, otherwise known as regular expression.

You will want to create a variable of type system.text.regularexpression.regex as otherwise you have to type that string every time.

In an If activity you can then write (your regex variable name here).Match(“Your string variable name here”, “[^a-zA-Z0-9\s’]”).value=“”

This will return a true or false based on if the regex returns a match or not and you can then perform your actions.

if Regex.match(a,"[^a-zA-Z0-9\s']").value=""
then
else
//if we do get a match.
Perform Click Action.

For more info the regex expression is performing these actions.
[ = open container
^ = NOT any of these
a-z = Any lower case letter in this range
A-Z = any uppercase letter in this range
0-9 = any number in this range
\s = any whitespace character
’ = the apostrophe character explicitly.
] = Close container.

I know this has been a long post but I hope that this helps.

Any questions please let me know.

1 Like

Thanks a lott…!:blush:

Hi Anusha,

This will match both hyphens and singular quotation marks. If you need this to also include the apostrophe then remove the ’ from the regex string.

1 Like