Cant clear HTML from \n \t

Hello! I’ve parsed the website and removed all the markup using an HTML extractor, but I still have newline and tab characters (\n and \t) left. Can you advise on how to remove them? My code block is unable to do this. How can I create clean text in this format:

Jasmin-Apotheke (ca. 1.5 km)
Lortzingstr. 42
13355 Berlin
Notdienst vom: 03.10.2023 09:00 - 04.10.2023 08:59
Telefon: 030 46404615

const inputList = $input.all();

// Cleaning each element of the list from spaces, newline, and tab characters
const cleanedList = inputList.map(item => {
  if (typeof item === 'string') {
    return item.replace(/\s+/g, '').replace(/\\n/g, '').replace(/\\t/g, '');
  }
  return item; // If an element is not a string, leave it unchanged
});

// Return the cleaned list
return { cleanedList };

MyWorkflow:

I know this might sound a bit silly, @wedlex , but does this still appear in JSON view? This might just be how n8n is showing the data in the table view :see_no_evil:

1 Like

just quick glance but it looks like your input is one item. I would make sure that your regex for your input its actually getting to the the JSON objects.

3 Likes

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