Removing brackets inside a string

Hey guys, its my first post here so I hope the category ist the right one.
I got a little Problem with the replace function.

I have the following string:
“Monatsbericht (1. Juni bis 30. Juni 2019) lorenz.mustermann EJ 2017”

I only want to have the part inside the brackets:
“1. Juni bis 30. Juni 2019”

Im not able to remove the brackets…
The part inside the brackets changes every month (german date)

Thank you for the help

1 Like

welcome to UiPath community
if the string is in a variable of type string
in_text = “Monatsbericht (1. Juni bis 30. Juni 2019) lorenz.mustermann EJ 2017”


out_text = Split(Split(in_text,“(”)(1).ToString,“)”)(0).ToString.Trim

Cheers @Lorenz_Goring

1 Like

Hi @Lorenz_Goring,
If it is considered that, your given string is is stored in a ‘string’ variable then you can try like this -

where ‘text’ is the main 'string variable and ‘part2’ is your main wanted outcome.

Thanks & Regards,

You could also use an assign like this: variable1.Substring(variable1.IndexOf("(") + 1, variable1.IndexOf(")") - variable1.IndexOf("(")-1)
Replace variable1 for the variable in which you have your string.

Thank you for the fast answer, i guess your solution is the same one as the selected solution.
But the selected solution was easier for me to understand.

1 Like

No worries
I tried to come up with a single step
First getting this value Split(in_text,“(”)(1).ToString
then getting this value Split( Split(in_text,“(”)(1).ToString ,“)”)(0).ToString.Trim

Cheers @Lorenz_Goring

1 Like

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