I tried VBA macro from MS Word(the PC i'm currently using doesn't have much stuff), it did not turn out to be great, so I tried it with Firefox console.
This is my current code:
function stripAnchorTags(html) {
return html.replace(/\<a.*\>.*\<\/a\>/, '');
}
console.log(stripAnchorTags('<a href="image location" style="margin-left: 1em; margin-right: 1em;"><img src="image location" border="0" height="400" width="640"></a></div><br><a href="image location" style="margin-left: 1em; margin-right: 1em;"><img src="image location" border="0" height="400" width="640"></a></div>'));
Now, the output I want was
<img src="image location" border="0" height="400" width="640"></div><br><img src="image location" border="0" height="400" width="640"></div>
But instead of it, I only get </div>
I have no idea what went wrong.