日期:2014-05-20 浏览次数:20919 次
StreamReader reader = new StreamReader("c:\\temp\\1.txt",Encoding.Default);
string source = reader.ReadToEnd();
Regex reg = new Regex(@"(?is)<b>.*?</b>");
source = reg.Replace(source, "");
public string ClearHtml(string HtmlStr)
{
string tmpStr = HtmlStr;
tmpStr = ReplaceHtml("&#[^>]*;", tmpStr, "");
tmpStr = ReplaceHtml("</?marquee[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?object[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?param[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?embed[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?table[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml(" ", tmpStr, "");
tmpStr = ReplaceHtml("</?tr[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?th[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?p[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?a[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?img[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?tbody[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?li[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?span[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?div[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?th[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?td[^>]*>", tmpStr, "");
tmpStr = ReplaceHtml("</?script[^>]*>", tmpStr, "");