Remove all brackets from Entire text

Hi All,

I want to remove all the brackets between my text in the entire string .I used the following below but did not get output.

If the initial invoice date stated above does not align to the execution date, then the initial invoice date will be the execution date. Databricks reserves the right to accelerate scheduled billing of fees for the Specified Commitment(s) (and associated Support Services, if any) if Customer’s usage exceeds the related amount for which it has been billed. Additionally, if Customer’s usage exceeds the applicable Specified Commitment or Universal Usage Commitment (e.g. Burst Usage), fees for such Burst Usage (and for associated Support Services, if any) shall be billed monthly in arrears. Fees above do not include True-up Payments (if any), which would be invoiced by Databricks after the End Date under the terms of this Order.

Hi @dutta.marina ,

You can delete brackets using the Replace Function, as seen below. I hope that helps you.

Yourstring.Replace("(","").Trim.Replace(")","").Trim

Regards,
Vinit Mhatre

Hi @dutta.marina

input = "If the initial invoice date stated above does not align to the execution date, then the initial invoice date will be the execution date. Databricks reserves the right to accelerate scheduled billing of fees for the Specified Commitment(s) (and associated Support Services, if any) if Customer’s usage exceeds the related amount for which it has been billed. Additionally, if Customer’s usage exceeds the applicable Specified Commitment or Universal Usage Commitment (e.g. Burst Usage), fees for such Burst Usage (and for associated Support Services, if any) shall be billed monthly in arrears. Fees above do not include True-up Payments (if any), which would be invoiced by Databricks after the End Date under the terms of this Order."

Output = System.Text.RegularExpressions.Regex.Replace(input,"[()]","")

Regards

Hi @dutta.marina
strValue= System.Text.RegularExpressions.Regex.Replace(strValue, "(?<=\().*?(?=\))", "")

strValue=strValue.Replace("()","")

Regards,
Arivu

@Vinit_Mhatre

Thanks It worked. In the same expression, how to remove the (comma ,) also. I want to remove bracket and comma from sentences

Simple add one more replace function like this

Yourstring.Replace("(","").Trim.Replace(")","").Trim.Replace(",","").Trim
1 Like

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