|","",RegexOptions.IgnoreCase);str=Rege..." />
 手机
当前位置:查字典教程网 >网页设计 >脚本HTML教程 >正则表达式过滤html的标签对
正则表达式过滤html的标签对
摘要:publicstringDealHtml(stringstr){//str=Regex.Replace(str,@"]*>|","",Reg...

   public string DealHtml(string str)
{
//str = Regex.Replace(str, @"<(img)[^>]*>|</(img)>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"<(table|tbody|tr|td|th)[^>]*>|</(table|tbody|tr|td|th)>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"<(div|blockquote|fieldset|legend)[^>]*>|</(div|blockquote|fieldset|legend)>", "", RegexOptions.IgnoreCase);
//str = Regex.Replace(str, @"<(font|i|u|h[1-9]|s)[^>]*>|</(font|i|u|h[1-9]|s)>", "", RegexOptions.IgnoreCase);
//str = Regex.Replace(str, @"<(style|strong)[^>]*>|</(style|strong)>", "", RegexOptions.IgnoreCase);
//str = Regex.Replace(str, @"<a[^>]*>|</a>", "", RegexOptions.IgnoreCase);
//str = Regex.Replace(str, @"<(meta|iframe|frame|span|tbody|layer)[^>]*>|</(iframe|frame|meta|span|tbody|layer)>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"<br[^>]*", "", RegexOptions.IgnoreCase);
str = str.Replace("<br>", "");
return str;
}

【正则表达式过滤html的标签对】相关文章:

用html的ul和li标签做图片展示功能示例代码

精通 JS正则表达式

python使用正则表达式分析网页中的图片并进行替换的方法

一个生成html的新方法

js常用正则表达式

为什么要使用html的meta标签?

HTML表格表头的边框色属性

在HTML中利用js调用php的内容

HTML表格表头的背景图象属性

HTML表格的表首标记

精品推荐
分类导航