public static string StripHTML(string stringToStrip)
        {
            if (!string.IsNullOrEmpty(stringToStrip))
            {
                stringToStrip = Regex.Replace(stringToStrip, "</p(?:\\s*)>(?:\\s*)<p(?:\\s*)>", "\n\n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                stringToStrip = Regex.Replace(stringToStrip, "<br(?:\\s*)/>", "\n", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                stringToStrip = Regex.Replace(stringToStrip, "\"", "''", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                stringToStrip = StripHtmlXmlTags(stringToStrip);
            }
            return stringToStrip;
        }
        private static string StripHtmlXmlTags(string content)
        {
            return Regex.Replace(content, "<[^>]+>", string.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled);
        }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2021-08-26
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
猜你喜欢
  • 2022-12-23
  • 2022-01-22
  • 2022-02-19
  • 2021-08-27
  • 2021-11-30
  • 2021-11-29
相关资源
相似解决方案