去除HTML标记C#,JS
来源:互联网 发布:科学数据geodata 编辑:程序博客网 时间:2024/05/14 17:51
C#
/// <summary> /// 去除HTML标记 /// </summary> /// <param name="strHtml"></param> /// <returns></returns> public static string StripHTML(string strHtml) { string[] aryReg ={ @"<script[^>]*?>.*?</script>", @"<(\/\s*)?!?((\w+:)?\w+)(\w+(\s*=?\s*(([""'])(\\[""'tbnr]|[^\7])*?\7|\w+)|.{0})|\s)*?(\/\s*)?>", @"([ ])[\s]+", @"&(quot|#34);", @"&(amp|#38);", @"&(lt|#60);", @"&(gt|#62);", @"&(nbsp|#160);", @"&(iexcl|#161);", @"&(cent|#162);", @"&(pound|#163);", @"&(copy|#169);", @"&#(\d+);", @"-->", @"<!--.* "}; string[] aryRep = { "", "", "", "\"", "&", "<", ">", " ", "\xa1", "\xa2", "\xa3", "\xa9", "", " ", "" }; string newReg = aryReg[0]; string strOutput = strHtml; for (int i = 0; i < aryReg.Length; i++) { Regex regex = new Regex(aryReg[i], RegexOptions.IgnoreCase); strOutput = regex.Replace(strOutput, aryRep[i]); } strOutput.Replace("<", ""); strOutput.Replace(">", ""); strOutput.Replace(" ", ""); return strOutput; }
- 去除HTML标记C#,JS
- js 去除 html 标记
- 去除HTML标记
- php去除HTML标记
- 去除HTML标记
- 去除HTML标记
- 去除html标记
- 去除HTML标记
- 去除HTML标记
- 去除HTML标记
- 去除HTML标记
- 去除HTML标记
- 转《去除HTML标记》
- 正则 去除html标记
- 去除HTML标记
- C#去除HTML标记
- 去除html标记,并保留某些标记
- 去除所有HTML标记函数
- Android 语音合成
- 高级分组rollup,cube操作
- hadoop作业引用第三方jar文件
- mysql 事物概念
- MSMQ经典消息传输队列
- 去除HTML标记C#,JS
- 自己对usb otg gadget的理解
- Ztree之初涉——简单Ztree的实现
- PHP_PDO 调用mysql 带返回参数的存储过程
- solr中文网
- HDU 3635 Dragon Balls 并查集水题 模拟
- eclipse离线和在线安装svn插件
- 时间操作ORACLE
- 位运算使用技巧