I want to replace all image tags in an HTML string. I wrote the below code. However it only replaces the first instance of it. How can I replace all?I tried replaceAll() method, it is not working in chrome.
let content = "Hello <img src='abc.png' alt='AMP Example' height='200'width='300' >. Learn more";
let result = content.replace(/(<img[^>]+>(?:<\/img>)?)/i, "$1</amp-img>");
console.log(result);
let final = result.replace('<img','<amp-img');
console.log(final);