文章出處

  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;

}


歡迎轉載:http://www.kanwencang.com/bangong/20161206/64696.html

文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()