Remove string and number inside the Bracket

Hi, I need to remove string and number along with Bracket.

Cargo Compressor #3(5XTD30), Cargo Pump #1(5WR110),Control Air Compressor(00693).

Please advise the node.

You can use this bit in a String Manipulation node:

regexReplace($column1$, "\\([^(,)]*\\)", "")

It uses a RegEx needle that looks for any combination of characters between brackets, with the exception that nested brackets are not allowed. Otherwise it would remove everything between the first β€œ(” and the last β€œ)”.

\\(.*\\) matches any combination of characters between brackets, including the brackets. The double backslash escapes the bracket, otherwise it would be interpreted as operator for substitution
[^(,)] matches any character except brackets. Here we don’t need the subsitution. We use it instead of the period for our exception.

1 Like

Thanks @Thyme it works fine.

1 Like

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