const regex = /(<(?![\/]?a)(?![\/]?img)([^>]+)>)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(<(?![\\\/]?a)(?![\\\/]?img)([^>]+)>)', 'g')
const str = `<!-- The line could look like this -->
<td align=right valign=bottom nowrap><div>January 24, 2013 </div></td>
<!-- Or this -->
<div>Is this system supported? </div>
<div>Is this system supported?</div>
<div><a href="game.com"></a><p>Test</p></div>
<!-- Even this -->
<span>This is a span tag </div>
<img src="example.com/example.jpg">
<img src="smiley.gif" alt="Smiley face" height="42" width="42">
<img src="example.com/example.jpg">
<a href="game.com"></a>
<div id="example"><img src="example.com/example.jpg">Hello World<a href="game.com"></a></div>`;
const subst = ``;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions