description = description.replace(/(\n)/g, ""); description = description.replace(/(\t)/g, ""); description = description.replace(/(\r)/g, ""); description = description.replace(/<\/?[^>]*>/g, ""); description = description.replace(/\s*/g, "");
6、脚本之家小编写的一个替换fackeditor中的多余br与空行的
//加强替换主要是考虑多个br的问题 function doRepAdvance(s){ var str=s.replace(/<p><br type="_moz"><\/p>/ig,""); str=str.replace(/<br type="_moz">\n <\/p>/ig, "</p>"); str=str.replace(/<br type="_moz">\n<\/p>/ig, "</p>"); str=str.replace(/<br type="_moz">\n\r<\/p>/ig, "</p>"); str=str.replace(/<br type="_moz"><\/p>/ig,"</p>"); str=str.replace(/<br \/>\n <\/p>/ig, "</p>"); str=str.replace(/<br>\n <\/p>/ig, "</p>"); str=str.replace(/<br \/>\n<\/p>/ig, "</p>"); str=str.replace(/<br \/>\n\r<\/p>/ig, "</p>"); str=str.replace(/(<br>\n){1,}<\/p>/ig,"</p>"); str=str.replace(/(<br>){1,}<\/p>/ig,"</p>"); str=str.replace(/<br>\n<\/p>/ig, "</p>"); str=str.replace(/<br><\/p>/ig,"</p>"); str=str.replace(/<p> <\/p>/ig,""); str=str.replace(/<p> <\/p>/ig,""); str=str.replace(/<p> <\/p>/ig,""); str=str.replace(/<p><\/p>/ig,""); return str; }
到此这篇关于js处理富文本编辑器转义、去除转义、去除HTML标签的正则的文章就介绍到这了,更多相关编辑器转义、去除转义、去除HTML标签内容请搜素脚本之家以前的文章或下面相关文章,希望大家以后多多支持脚本之家!
您可能感兴趣的文章: