Need help with string.replace()

Hi buddies,

I want to delete/replace a kind of text in a string.
The issue is that there is a text between two or more coincidences and i don’t want to delete it.
I.E. “this is the (1 fdasdf) string and (14.54 fdd) this is all”
i want to replace (1 fdasdf) and (14.54 fdd) but without replace “string and”

The output would be “this is the string and this is all”

I am worried because i dont know how many coincidences (*) will have and i cant know how many chars will be inside the ().

Please anybody can help me , i tried string.Replace(".()","") but it doesn’t works.

Thanks in advance!! :wink: )

@cacafundi
it can be done with regex:
grafik

1 Like

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(text,"\(.*?\)",String.Empty)

Regards,

1 Like

Thank you so much Buddies!! i will try and get back with feedback.

BR :wink:

A billion of thanks Buddies!!

Both methods works fine!!
\((.*?)\) from buddie ppr in replace activity and Yoichi buddie in assign !!!

Thanks !! & BR :wink: .

1 Like

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