JS过滤(去除)富文本编辑器中的HTML标签和换行回车等标记的正则表达式
2017-02-10 11:29
671 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> JS过滤(去除)富文本编辑器中的html标签和换行回车等标记的正则表达式</title> <script language="javascript"> function show(){ var test="<p>\n\t<img src=\"http://localhost/Scripts/KindEditor/Editor/plugins/emoticons/images/0.gif\" alt=\"\" border=\"0\" />ds<em>fds</em>\n</p>\n<p>\n\ts<span style=\"font-size:16px;\">dfd</span>sf<img src=\"http://localhost/Scripts/KindEditor/Editor/plugins/emoticons/images/19.gif\" alt=\"\" border=\"0\" />ds<strong>fdsfds</strong>\n</p>\n<p>\n\t<br />\n<strong></strong>\n</p>\n<p align=\"center\">\n\t<strong>d<span style=\"font-family:FangSong_GB2312;\">ssa</span>dasasdsad<u>dfds</u><br />\n</strong>\n</p>" test = test.replace(/(\n)/g, ""); test = test.replace(/(\t)/g, ""); test = test.replace(/(\r)/g, ""); test = test.replace(/<\/?[^>]*>/g, ""); test = test.replace(/\s*/g, ""); document.getElementById("sd").innerHTML=test; } </script> </head> <body onload="show();"> <div id="sd"></div> </body> </body> </html>
相关文章推荐
- js过滤(去除)富文本编辑器中的html标签和换行回车等标记的正则表达式
- python正则表达式去除html标签
- 【转】java使用正则表达式去除字符串的html标签
- java正则表达式去除html中所有的标签和特殊HTML字符(以&开头的)
- Java中正则表达式去除html标签
- 利用正则表达式实现去除所有HTML标签代码
- asp中正则表达式去除HTML标记(窃自eWebEditor)
- [转]正则表达式,去除所有HTML标签
- 去除网站中HTML标签的正则表达式
- java正则表达式去除html标签
- java正则表达式去除html标签
- Python通过正则表达式获取,去除(过滤)或者替换HTML标签的几种方法(本文由169it.com搜集整理)
- java正则表达式去除html标签
- java/android 正则表达式去除所有HTML标签
- java正则表达式去除html标签
- 正则表达式,去除所有HTML标签
- 正则表达式 去除相应HTML 标记
- python自带re模块正则表达式去除html标签
- 正则表达式去除html标签
- 利用正则表达式去除HTML标签