I am scraping a website and need to remove all the /n and /t from my strings.
I have tried the following code:
item.post_category = [];
Array.from($doc.find('h6.link')).forEach(function(link){
console.log(link.textContent.replace(/t+n+/gm, ""));
item.post_category.push(link.textContent);
})
//this removes the linebreaks but not the tabs
Here are multiple sample array I have to iterate over:
["ntttttJune 15, 2021 • nttttttntttttnttttttttttntttttttttttttttnttttttFamily,ntttttntttttttttttttttntttttttttttttttnttttttGender Equality,ntttttntttttttttttnttttttnttttttnttttttntttttntttttntttttttttttntttttIn the Newsntttt"]
["ntttttJune 13, 2020 • nttttttntttttnttttttnttttttnttttttnttttttntttttntttttntttttttttttntttttIn the Newsntttt"]
["ntttttJuly 5, 2021 • nttttttntttttnttttttnttttttnttttttnttttttntttttntttttntttttttttttntttttNewsntttt"]
IDEALLY, I would want my arrays to look like this. Remove the date AND the n and t.
["Family,Gender Equality,In the News"]
["In the News"]
["News"]