Problem: Error while executing regexReplace command

I’m trying to replace \N or \n to “Unknown”.

So I used two methods:

  1. Column Expressions Node
    replace(column(“Alias”), “\N”, “Unknown”)

Output: \Unknown
How to remove that foward slash? So, I can only get word “Unknown”


regexReplace(column(“Alias”),"^[\][Nn]$" ,“Unknown” )

Output: Errors. When I tested on, it does work well. It filters out \n and \N.

  1. String Manipulation Node
    replace($Alias$, “\N”,“Unknown”)

Output: \Unknown

What did I do wrong here?

Hello @HeroVax
Aiming to replace back slash as part of the text you may need to use two scape back slashes ahead:

regexReplace($Alias$, "\\\n", "Unknown")



Hello @gonhaddock ,

I did execute the following command (with capital N) and it works:
regexReplace($Alias$, “\\N”, “Unknown”)

Output: Unknown

However, the smaller char “n” does not work. It shows errors.

Hi @HeroVax
Just to clarify:
I supposed that you wanted to remove a line return “\n” - you need two back slashes ahead \\+\n
This happens to characters that has a meaning in regex.

i.e. If you have a pipe “|” in your text, this symbol means OR in regex. To tell regex that you ar working with a string , then you need to indicate that pipe is a text with a double back slash ahead: \\+| == “\\|”

I can’t see further unless you can share some sample of your data.


1 Like

Hi @HeroVax @gonhaddock , a simple replace() is enough here instead of regexReplace()

1 Like

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