Keep value inside ()


I am wondering if there is a way to trim and keep values inside ().
For example, I am scraping a text and getting the value “John Evans (Jonny)”, and I would like to create an assign value or similar to trim it to only keep the “Jonny” value.
Does it have to be turned into a datatable and then use Filter Datatable activity or is it an easier way of doing it?
Thanks in advance!

Best regards

such tasks are done with RegEx

a play with

returns following groups:

so group2 can be trimmed.

Just to give a starter help, feel free to adopt and to enhance


You can use the Split and Substring method to achieve that
Variable_name.Split(" "c)(2).Substring(1,5)



@Robert_Wennberg You can maybe use the String Split operation in this way as well :

Split(Split(“John Evans (Jonny)”,"(")(1),")")(0).Trim


Hi @Robert_Wennberg

Below regex will give the value within Bracs() everytime.

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:



Thank you for always giving easy to understand and correct solutions.
In this case, the names I get are dynamic, so by just switching out the “John Evans” part to my variable, I managed to trim the text just the way I wanted!


Thank you for your quick and informative response.
However, I am not yet familiar with RegEx but I would like to understand more of it since it seems to be fairly used together with UiPath… Is there any place you could recommend to study it for beginners? Sorry for the inconvenience

Refer this post


1 Like


I also have a followup question regarding the trimming. Is there a way to remove text and leave special characters such as Japanese kanji? Something like this:

Example: "Ryosuke Maeda 前田 凌佑 "
Expected result: “前田 凌佑”

The name will be dynamic.


along with the linked post from @Steven_McKeering
playing in is a good first stop to start and grow



Got it, thank you very much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.