public static string ReplaceAllTag(this string txt)
{
txt = Regex.Replace(txt, "<style[^>]*?>[\\s\\S]*?<\\/style>", "");
txt = Regex.Replace(txt, "<script[^>]*?>[\\s\\S]*?<\\/script>", "");
txt = Regex.Replace(txt, "<[^>]+>", "");
txt = Regex.Replace(txt, "\\s*|\t|\r|\n", "");
txt = Regex.Replace(txt, " ", "");
txt = txt.Replace(" ", "");
txt = txt.Replace("\"", "");
txt = txt.Replace("\"", "");
return txt;
}
public static string ReplaceContent(this string txt)
{
txt = Regex.Replace(txt, "<source.*?>", "");
txt = Regex.Replace(txt, "<video.*?>", "");
txt = Regex.Replace(txt, "</video>", "");
txt = Regex.Replace(txt, "class[^=]*=[\"']*[^\"'>]+[\"']*", "");
txt = Regex.Replace(txt, "style[^=]*=[\"']*[^\"'>]+[\"']*", "");
txt = Regex.Replace(txt, "width[^=]*=[\"']*[^\"'>]+[\"']*", "");
txt = Regex.Replace(txt, "height[^=]*=[\"']*[^\"'>]+[\"']*", "");
txt = Regex.Replace(txt, "href[^=]*=[\"']*[^\"'>]+[\"']*", "");
txt = Regex.Replace(txt, "<style[^>]*?>[\\s\\S]*?<\\/style>", "");
txt = Regex.Replace(txt, "<script[^>]*?>[\\s\\S]*?<\\/script>", "");
txt = Regex.Replace(txt, " ", "");
txt = Regex.Replace(txt, "<p></p>", "");
txt = Regex.Replace(txt, "figure", "p");
return txt;
}
|