Search, Match and Add-On to String or Replace

Hello all,

using the same example, previously shown here but topic closed.

Search & Replace in strings via list of keywords-new example.knwf (14.7 KB)

On the result. I would like to add the word "beautiful with the quote before it (beautiful is a fixed value).
Before the variables found on the list.

On top of that. I need to replace/add to, the current found variables of the same list, a quote at the end of itself (the variable) every time it is found on the list. In the end, I need something like this:

Input Old “removal” Example What I need
ReFX London White London White “beautiful ReFX” London White
ReFX London Black London Black “beautiful ReFX” London Black
Steinberg Paris Red Paris Red “beautiful Steinberg” Paris Red
Steinberg Paris Green Paris Green “beautiful Steinberg” Paris Green
Native Instruments New York Yellow New York Yellow “beautiful Native Instruments” New York Yellow
Native Instruments New York New York “beautiful Native Instruments” New York
Izotope Something for Steinberg blue Izotope Something for blue Izotope Something for “beautiful Steinberg” blue
Izotope Something for Steinberg red Izotope Something for red Izotope Something for “beautiful Steinberg” red
I love my Yamaha Black Long Pianos I love my I love my “beautiful Yamaha Black Long Pianos”

The Input on my real use case, sometimes will have spaces, sometimes not, that is the reason I need the column to search on the variable list, match a variable and add quotes at the end of it, and add the quotes in the beginning of a fixed value that will always come prior to the variable.

I have tried for a long time making changes to the workflow provided but the closest I could get when trying to add the ‘variable’ to the expression, was to copy the ‘concatenated’/‘aggregated’ value every time it found an expression.

strip(replace(regexReplace($column1$, $${SConcatenate(column1)}$$, $${SConcatenate(column1)}$$), "  ", " "))

So the result would be something like :

Native Instruments|Steinberg|ReFX|Yamaha Black Long Pianos Paris Green

I have also tried the version without the strip.

Thanks a lot,
J.

Hello,

I think you’ll need loops instead.

Is it possible that a keyword like “ReFX” and “Steinberg” appear in the same sentence?

The first solution I’ll offer is inefficient computationally but can deal with such a case - use a table loop to variable loop start node to check each sentence for each keyword and a simple replace with your keyword using string manipulation.

The second solution I can offer uses recursive loops to be more computationally efficient (faster). Tag each sentence as having been checked for your keyword in each iteration and then filter out sentences that have a tag while keeping sentences without a tag for further processing.

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