Remove special characters

I have the following code in the code node, it is working, but I want to format the cnpjs by removing the special characters, leaving only numbers.

my code:

const cnpjs = []

for (const cnpj of $input.all()){
  cnpjs.push(cnpj.json)
}


return cnpjs

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:

hello @Gabriel_Elias

you can do it with regex

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