My code is:
function unrichText(texto) { var n = texto.indexOf("\">"); //Finding end of "<div class="ExternalClass..."> var sub = texto.substring(0, n+2); //Adding first char and last two (">) var tmp = texto.replace(sub, ""); //Removing it tmp = replaceAll(tmp, "</div>", ""); //Removing last "div" tmp = replaceAll(tmp, "<p>", ""); //Removing other stuff tmp = replaceAll(tmp, "</p>", ""); tmp = replaceAll(tmp, " ", ""); return (tmp); } function replaceAll(str, find, replace) { return str.replace(new RegExp(find, 'g'), replace); }
source share