|I am trying to create a script that will clean up unnecessary HTML tags in a text string, caused by users playing about with fonts etc.|
An example would be starting with a string like this:
aaa<span style="font-size: larger">bbb</span>ccc
I can strip out the font using:
$html_string_new = $html_string.replace(/font-size.*;/g, "");
which leaves me with:
That has basically achieved what I wanted to do, however is the <span> tags have nothing left active, I would like to remove them, leaving the string as:
Is there a way to scan for <span style="">*<\/span> and to retain the code that is in the middle (in this case "bbb")?