I have a source program that delivers text with non html tags and incorrect syntax. for example:
the <H>quick</> brown fox.
the <U>quick</> brown fox.
<H><U>The</> quick brown fox.
<H><U>The</> quick </> brown fox.
The out come should be someting like:
the quick brown fox.
the quick brown fox.
The quick brown fox.
The quick brown fox.
So the tags used are not html-valid, but also not closed as they should. I'm struggling to get this working in javascript.
started with something like:
var s = document.getElementById('root').innerHTML;
s = s.replace("<H>", "<b>");
s = s.replace("<h>", "<b>");
s = s.replace("</>","</b>");
document.getElementById('root').innerHTML = s;
root is the all containing div. The tags will appier in a div with class "label components", there will be multiple divs with class "label components" (and thus multiple times the incorrect tags on a page).
how can I best tackle this?