文章出處

//過濾\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, @"&nbsp;", "", RegexOptions.IgnoreCase);
            //獲取body中的所有table
            Regex regex = new Regex(@"<table.*?>[\s\S]*?<\/table>");
            MatchCollection mc = regex.Matches(result3);
            //獲取集合類中自己需要的某個table
            String newHtmlStr = mc[3].ToString();


文章列表


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

    IT工程師數位筆記本

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