Search & replace in strings via list of keywords

Hi!

I need you help. I hope you have a idea. :slight_smile:

My example:
In my data list I have a column with product namens.
Additonally I have a list with brands.

Now I want to search each of the brands and replace it with nothing.

Result must be: product name without the brand for each of the rows in the data list.

Thank you in advance.

Andre

Hi @AndreP

If your brand-name doesn’t contain white spaces, than the Cell Splitter is the way to go. Otherwise a different solution is needed. Does any of your brandnames in the list contains white space?
gr. Hans

Hi @HansS ,

oh yes. Spaces are possible in brand namens. :slight_smile:

BR

Andre

1 Like

Hi @HansS,

Example with brands with spaces.

BR

Andre

Hi @AndreP , also can a brand name contain another brand name?

For example:
Native Instruments
Instruments

If this can happen, then the order of the replace is important.

EDIT: One more thing, can a record contain more than 1 brand?

In the mean time, I put something together based on the data that you showed, and results as follows:
image

Workflow looks like this:
image

Assumptions:

  • no brand name contained in another brand name

Note: Doing it this way (only works with the above assumption), it does not matter if a record contains more than 1 brand. If it’s done another way, it might matter to know.

Here’s the workflow: Search & Replace in strings via list of keywords.knwf (12.4 KB)

Note: The requirement was “to search each of the brands and replace it with nothing”, which is what the workflow is doing. However, that means that there will be a space at the beginning if the brand was at the beginning, since the records are . So replacing with nothing results in . If you want to remove the space at the beginning, you can just use the strip() function and add it to my string manipulation:
Change from
regexReplace($column1$, $${SConcatenate(column1)}$$, "")
to
strip(regexReplace($column1$, $${SConcatenate(column1)}$$, ""))

Hi Bruno,

thank you very much for your help.
The solution is very close to what I need.

Only one thing are not perfect.

So I wanted to consider the beginning of the string and the space at the end of the brand, so that I am 100% sure that it only deletes the brand at the beginning of the string.

My plan was to search for “Steinberg *” and replace it with “”.

Because what happens now is this:

Hi @AndreP , that was exactly my point :slight_smile:

So, modify the expression to this:
strip(replace(regexReplace($column1$, $${SConcatenate(column1)}$$, ""), " ", " "))

EDIT: Somehow the forum is not showing the 2 spaces even though it’s preformatted text.

So I made the modifications in the workflow, and took the opportunity to add your new data:
image

Here’s the modified workflow: Search & Replace in strings via list of keywords.knwf (12.4 KB)

EDIT 2: Did not notice that you added Izotope as a text to be removed. It’s just data, so it does not change the logic of the workflow, but just to show that the same workflow works as expected when adding Izotope, here’s the result:
image

@bruno29a but not my point :smiley: :smiley: :smiley:

I want to keep the brand in the middle of the string!
So I only want to replace it with nothing when the keyword at the beginning of a string.

Backround: Sometimes a brand name can be also a part of a product name of a brand.

Hi @AndreP , ahhhh, I thought you meant to remove the double spaces. OK, I got it now, so you only want to remove the brand if it’s at the beginning.

Like this?
image

This is how the new workflow looks like:
image

Here’s the new workflow (I renamed it to reflect what you are looking for): Remove keywords at the beginning of strings.knwf (13.7 KB)

2 Likes

Hi @bruno29a ,

Great! reeeally great. Thank you very much!

The ^ means in this case “need to be at the beginning”?

BR

Andre

That is correct @AndreP

Please mark it as Solution if it works for what you’re looking for, so that other users can see the solution quickly, and the thread can close sooner.

1 Like

Thanks again!

Done :slight_smile:

2 Likes

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