Multiple search & replace executes on the same value

Hi!
I have a question again.

I need a workflow that executes search & replace multiple times on the same value.
Additonally with a list of search & replace terms.

So far I’ve only managed to get one value replaced per interation.
See my Example.

Thanks in advance!

have you tried nested replace within the same string manipulation node?
e.g.
replace(replace(…))
br

1 Like

Hi,

thats works for a small fixed number og cases.

But how do I handle this when the list is always expanding? At some point I will have hundreds of terms there. The formula would then become endless.

Any other Idea?

I test JavaSnippet (simple) node now. Maybe that can be a solution.

BR

Andre

JavaSnippet has no possibilty to add the rule via flow variable. Therefore no option too.

But I handle it now via recrusive loop instead of the normal loop. Thats works now! :slight_smile:

Hope thats helpful for anyone else with the same request. :slight_smile:

2 Likes

Probably depends on the length of the list. (Regexreplace could be an option)
glad that you found a solution for you
br

2 Likes

Hello @AndreP
I couldn’t avoid to give it a try. I can visualized two possible solutions to your challenge:

  1. The first one would be an upgrade of your solution; by using recursive loop. But you already worked out by yourself.

  2. The alternative solution is the one that I consider more interesting, as it explores KNIME nodes functions and format properties. It is based in Tagging and Replace of Document format, avoiding loop iterations. I’ve prepared a workflow example for your use case.

Please share your thoughts about.

BR

2 Likes

Hi, I tried it. Looks like a good solution! Works for me. Thanks!

1 Like

Hi @AndreP
Thank you for validating the the solution.
I had some concerns about scaling from mock to real dataset. Your feedback is appreciated.

BR

OK I test it on my example cases. Still have to check it with a big load of data. But this needs some days on my side. :slight_smile:

1 Like

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