web前端

位置:IT落伍者 >> web前端 >> 浏览文章

正则表达式过滤html标签对


发布日期:2018年08月06日
 
正则表达式过滤html标签对

public string DealHtml(string str)

{

//str = RegexReplace(str @\<(img)[^>]*>|<\/(img)> RegexOptionsIgnoreCase);

str = RegexReplace(str @\<(table|tbody|tr|td|th)[^>]*>|<\/(table|tbody|tr|td|th)> RegexOptionsIgnoreCase);

str = RegexReplace(str @\<(div|blockquote|fieldset|legend)[^>]*>|<\/(div|blockquote|fieldset|legend)> RegexOptionsIgnoreCase);

//str = RegexReplace(str @\<(font|i|u|h[]|s)[^>]*>|<\/(font|i|u|h[]|s)> RegexOptionsIgnoreCase);

//str = RegexReplace(str @\<(style|strong)[^>]*>|<\/(style|strong)> RegexOptionsIgnoreCase);

//str = RegexReplace(str @\<a[^>]*>|<\/a> RegexOptionsIgnoreCase);

//str = RegexReplace(str @\<(meta|iframe|frame|span|tbody|layer)[^>]*>|<\/(iframe|frame|meta|span|tbody|layer)> RegexOptionsIgnoreCase);

str = RegexReplace(str @\<br[^>]* RegexOptionsIgnoreCase);

str = strReplace(<br> );

return str;

}

               

上一篇:XML WebService完全实例详细解析

下一篇:图片上传的WebForm(自动生成所略图)