Replace parts of one column based on another

Hello All,

I do some manipulation with address data and need to achieve the following.

I have 2 columns. The text in column 1 represents (always) a part of the text in column 2 next to it.

I want to delete this (and only this) part in column 2.

The respective replacement shall always happen in the same row, so e.g. the text in column 1 and 2 always are in the same row.

An example:

Column 1                  Column 2                              desired result in column 2 after replacement

Test street               Test street 2                                                       2

City centre             city centre test place                                     test place

Test lane                  Test lane 121a                                                 121a

Which node is suitable for this, any idea how to do this.?

Thanks a lot,

Jürgen

 

Hi Juergen,

you are looking for the String Manipulation node. You can use the replace() function to replace in the second column the matching string from the first column with an empty string "". Something like:

replace( column2, column1, "" )

Cheers,
Marco.

Hi Marco,

 

thanks for the tip, yet if I configure it in the way you suggest I always end up with 2x the same content-so it replaces ALL but not a part.

So instaed of

Column1         Column 2

Test street          2

City centre        test place

Test lane             121a

I end with

Column1         Column 2

Test street          Test street

City centre        City Centre

Test lane             Test lane

 

Not sure If I do smth wrong or miss any pre-work like e.g. tagging?!

Thanksa  lot,

Jürgen

 

 

got it, was an error in the order when I replaced another part of the string..by this the replacing and to be replaced didnt match everywhere 100%..string manipulation does the job :-)

Good! Glad it worked. If you still have issues with the cases (upper/lower-case), you can use the replace() version with the fourth argument "i".

Cheers,
Marco.

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