Remove new line from string

Describe the problem/error/question

Hi team,

I want to remove newline characters (\n) from the output. I am using the replace function, but the \n still appears in the output.

Could anyone please help with this?

Thanks.

What is the error message (if any)?


\n \n both should be removed from propertyName1.

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@Gouravdev , you seem to have two different β€œtypes” of new line - actually a new line and the representation of the new line with β€œ\n”. Your expression is removing the actual new line but not the string β€œ\n”. You need to add .replaceAll('\n', ' ') alongside .replace(/\\n/g, ' ').

1 Like