I am using this regex to try to find links that look like this and replace them with only the content between the start and end tag of the link.
The regex:
/<a class="tag_link"[^>]*>([^<]*)<\/a>/mg
I tested the regex on a sample code and it works, but when i try to apply it on object.innerHTML it doesnt replace anything. What is wrong?
The code:
document.getElementById(preview_div_ID).innerHTML.replace(/<a class="tag_link"[^>]*>([^<]*)<\/a>/mg, '$1');
document.write(document.getElementById(preview_div_ID).innerHTML);
Some sample html that is in "document.getElementById(preview_div_ID).innerHTML" above:
<h5 style="line-height: 9px; margin: 2px; ">
<span style="font-size: 7px; line-height: 8px; ">
Ost- (caseous) <a class="tag_link" href="javascript:;" onclick="open_tag('nekros', this);">nekros</a>
</span>
</h5>
Any help is much appreciated