cannot replace string on column expression

Hi,

I am trying to fix some words in “Yorum” column by replacing to correct ones. As shown on picture I added replace functions one by one by using expression editor.

But it dos not effect. On the ouyput table nothing change.

Did I miss something?

thanks for help.

Hello @metinergoktas
I don’t think that this node is the best choice for this use case; as you have to code all the statements; The code that you are trying to achieve has to be based on ‘else if’ statements (an example code with limited umlauts in my keyboard)…

if(regexMatcher(column("Yorum"), "guzel") == true){
    replace(column("Yorum"), "guzel", "güzel") 
} else if (regexMatcher(column("Yorum"), "tessekkur") == true){
    replace(column("Yorum"), "tessekkur", "tessekkür") 
} 
# [...] so on

There are more simple approaches, like; if you have a replacement dictionary tabulated within two columns, you can use the Value Lookup (Cell Replacer v 4.7) node for this task, avoiding any coding.

BR

1 Like

Thanks

but I am looking for more simple solution. I was trying to do that task with string manipulation using regexReplace but every time I faced that error. I added the screenshot.

I just want to replace some words with the correct ones.

Could you give me an example column expression node usage with the expressions list that contains more than one regexReplace functions?

or any other solution ?

Hello @metinergoktas
Sometimes simple solutions require complex concepts to make it work.

The functionality that you display in picture is a String Manipulation, then you would have to remove the ending semicolon, but will be valid only for a single dictionary replace rule…

Furthermore about the regex expression in your picture, the square bracket is redundant, as you are trying to achieve an exact match.

Can you provide, as I can’t reproduce your umlauts; some sample data (paste the text in a post, or excel would be ok too) with few representative replacements? We can deliver different proposals on how to achieve it. I still don’t know if you want to replace full words (isolated?, in a sentence?) or characters occurrences in a string; because I don’t have the context of your challenge.

I have different solutions in mind. A Cross Joiner and a String Manipulation with a regex code, can work as well.

Let us know.
BR

1 Like

Hey @metinergoktas,

Try the below solution

Input Data
1

This expression will replace oldString1 with newString1, oldString2 with newString2, and oldString3 with newString3 in the specified column.

  1. Using String Manipulation node use this expression

  2. Using Column Expression node use
    3

Output

I have also attached workflow for your reference
Convert String.knwf (74.0 KB)

Regards,
Yogesh

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