//過濾\n 轉換成空
String withoutNString=message.Replace("\n", "");
//過濾\r 轉換成空
String withoutRString = withoutNString.Replace("\r", "");
//過濾\t 轉換成空
String withoutTString = withoutRString.Replace("\t", "");
//過濾\ 轉換成空
String newString = withoutTString.Replace("\\", "");
//獲取html中的body標簽
String result = Regex.Match(newString, @"<body.*>.*</body>").ToString();
//過濾注釋
String result2 = Regex.Replace(result, @"<!--(?s).*?-->", "", RegexOptions.IgnoreCase);
//過濾nbsp標簽
String result3 = Regex.Replace(result2, @" ", "", RegexOptions.IgnoreCase);
//獲取body中的所有table
Regex regex = new Regex(@"<table.*?>[\s\S]*?<\/table>");
MatchCollection mc = regex.Matches(result3);
//獲取集合類中自己需要的某個table
String newHtmlStr = mc[3].ToString();
文章列表