Remove multiple words from a string

Hello, I have a situation where I need to remove business entity types from a list of customer names. I have a list of 195 of these words/abbreviations (i.e. Inc, Co, Corp, LLC).

In the String Manipulation node, I can choose Remove, but I prefer to use Replace because I have the ability to use modifiers which is critical. It would be nice if I could use Remove and still use modifiers but that doesn’t appear to be possible. I need to ensure only whole words are replaced and the case needs to be ignored.

My issue is that I can’t seem to enter multiple expressions. Here is a screen print of the expressions and the error.

What am I doing wrong? I have been reading the forum for hours now and have tried all of the other ways to do this that I have found, but nothing seems to work for me. I’ve only been using KNIME for a couple of weeks now and I have no previous experience with using tools like this.

Thank you for the assistance.
-Matt

It should be only 1 line. I think you can input multiple replacing string in one function.

5 Likes

Hi @rowles_2,

as @izaychik63 said, you should do it in one line
e.g.

replace(Replace(col1,“ABC”,""),“123”,"")

also you do not need a ; at the end.
Beside that it looks fine :slight_smile:

Alternatively you can also you two:

“If I could use Remove and still use modifiers but that doesn’t appear to be possible”
With the regex option in the string replacer node, that should be possible

“I have a list of 195 of these words/abbreviations (i.e. Inc, Co, Corp, LLC).”
Maybe a recusive loop or a dictionary replace would be better for this many words :thinking:

10 Likes

I was able to achieve what I needed by using a recursive loop. Thanks for the information.

2 Likes

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