C# 過濾空格、換行、script、style等等標籤
阿新 • • 發佈:2019-01-28
/// <summary> /// 過濾空格、換行、script、style等等標籤 /// </summary> /// <param name="html">html的內容</param> /// <returns>處理後的文字</returns> internal static string SHTML(string html) { html = html.Trim(); html = html.Replace(@"/<script[^>]*?>(.*?)<\/script>/si", ""); html = html.Replace(@"/<style[^>]*?>(.*?)<\/style>/si", ""); html = html.Replace("\t", ""); html = html.Replace("\r\n", ""); html = html.Replace("\r", ""); html = html.Replace("\n", ""); html = html.Replace(" ", ""); html = html.Replace(" ", ""); //html=html.Replace("",""); return html; }