Remove HTML tags
function removehtmltab (tab) {return tab.replace (/<[^<>]+?>/g, ');//delete all HTML tags}
Convert ordinary characters to a signifier
function Html2escape (sHtml) {return shtml.replace (/[<>& "]/g,function (c) {return {' < ': ' < ', ' > ') : ' > ', ' & ': ' & ', ' ' ': ' " '} [c];});}
Convert the signifier to ordinary characters
function escape2html (str) {var arrentities={' lt ': ' < ', ' GT ': ' > ', ' nbsp ': ', ' amp ': ' & ', ' quot ': ' '}; Return Str.replace (/& (Lt|gt|nbsp|amp|quot);/ig,function (all,t) {return arrentities[t];});
turn into spaces
function Nbsp2space (str) {var arrentities = {' nbsp ': '}; return Str.replace (/& (nbsp);/ig, function (all, t) {return ARRENTITIES[T]})}
Return to BR label
function return2br (str) {return str.replace (/\r?\n/g, "<br/>");}
Remove the opening end wrap and convert more than 3 consecutive lines to 2 line breaks
function Trimbr (str) {Str=str.replace (/(((\s| ) *\r?\n) {3,}/g, "\r\n\r\n");//limit up to 2 line break str=str.replace (/^ (\ s| ) (*\r?\n) +/g, ");//clear the opening newline Str=str.replace (((\s| ) *\r?\n) +$/g, ');//clear end newline return str;}
Combine multiple contiguous spaces into a single space
function Mergespace (str) {str=str.replace (/(\s| ) +/g, "); return str;}
JS Convert HTML escape character