Replace string or extract the data from the string

Hi Team,

I am looking for extracting the data from the below example
"ALB. ABRILONGO © (19O/10C) "

Column 1 should have only “19O/10C”
Column 2 should have only “ALB. ABRILONGO”
Column 3 should have “ALB. ABRILONGO ©”

Any formula for the above three columns, please
Thanks,
Poornima

Hi @PoornimaRamesh , I can return the three columns via three individual Regex Split nodes, but am I to assume that this is merely a sample and you’d want the solution to work with other data based on the same pattern? If so, we’d need to know what the key “markers” in your data are.

For example, the following three regex will find Columns 1, 2 and 3 respectively for your data:
image

Everything inside the brackets:
.*\((.*)\).*

Everything up to the second space:
(.*?\s.*?)\s.*

Alternatively, everything up to but not including the space and copyright symbol:
(.*?)\s©.*

Everything up to the first bracket:
(.*)\(.*

It really depends on if you have a standard data format as to whether these will work for what I imagine will be other data too.

image

The three can be combined into a single Regex Split node as
((.*?)\s©.*)\((.*)\).*

image

Or the same using the Palladian Regex Extractor, as

((.*?)\s©.*)\((.*)\).*

In both cases it can generate three columns and you can then use column rename and column resorter to put them in the required order

5 Likes

Thanks so much, Takbb. This is going to be a great solution

1 Like

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