Get rid of Brackets in a String

Hello, I have been recently faced with a very simple problem, which I unfortunately cannot solve:

I have a column “XYZ” including the following strings:
(1)
(2)
(3)
(4)
(5)

What I would need is to get rid of those brackets and save the result in a number format. How could I do that?

I tried Regex Split Node, but it didn’t work. Maybe i used the wrong Formula. I used this one: (.*)

Thank you in advance!

You can use a String Manipulation-Node with »removeChars($XYZ$, “()”)« and afterwards convert it to a number with a String To Number-Node.

Ansgar

3 Likes

Hi there @Milovanova,

although you are not splitting cell this is syntax you can use in Regex Split node:

[\(]([0-9]+)[\)]

Br,
Ivan

2 Likes

Thank you, it worked :slight_smile:

1 Like

Hi
square bracket are not necessary in regex pattern if you know that parentheses are always present.
You can write:

(([0-9]+))

Hi @pigreco,

don’t understand your comment :confused:

Br,
Ivan

There was a problem with escape of escape regex.
I mean that when you write [\(] you are defining a set with a single char: (
If you know that the string start with ( and end with ), your regular expression can be \(([0-9]+)\) (without square brackets over round brackets)

1 Like

Hi @pigreco,

I see now what you are thinking. You are right. Tnx!

Br,
Ivan

1 Like

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