Html suppress certain tags when extracting

ok this seems to have fixed it, it didnt like the regex

const regex2 = /<img .*?>/gm;
const regex = /<a[^>]*>(.*?)<\/a>/gm;


const response = [];

for (const item of items) {
  let content = item.json.Content;
  const matched = content.match(regex);
  const matched2 = content.match(regex2);
  if (Array.isArray(matched)) {
    for (const match of matched) {
      content = content.replace(match, 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
      if (Array.isArray(matched2)) {
    for (const match2 of matched2) {
            content = content.replace(match2, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
    }
    }
  }
  
  response.push({
    json: {
     content,
     }
  })
}}

return response;