public string RemoveHtml(string html)
{ Regex regex1 = new Regex(@"<script[\s\S]+</script *>", RegexOptions.IgnoreCase); Regex regex2 = new Regex(@" href *= *[\s\S]*script *:",RegexOptions.IgnoreCase); Regex regex3 = new Regex(@" no[\s\S]*=", RegexOptions.IgnoreCase); Regex regex4 = new Regex(@"<iframe[\s\S]+</iframe *>", RegexOptions.IgnoreCase); Regex regex5 = new Regex(@"<frameset[\s\S]+</frameset *>", RegexOptions.IgnoreCase); Regex regex6 = new Regex(@"\<img[^\>]+\>", RegexOptions.IgnoreCase); Regex regex7 = new Regex(@"</p>", RegexOptions.IgnoreCase); Regex regex8 = new Regex(@"<p>", RegexOptions.IgnoreCase); Regex regex9 = new Regex(@"<[^>]*>",RegexOptions.IgnoreCase); html = regex1.Replace(html, ""); html = regex2.Replace(html, ""); html = regex3.Replace(html, " _disibledevent="); html = regex4.Replace(html, ""); html = regex5.Replace(html, ""); html = regex6.Replace(html, ""); html = regex7.Replace(html, ""); html = regex8.Replace(html, ""); html = regex9.Replace(html, ""); html = html.Replace(" ", ""); html = html.Replace("</strong>", ""); html = html.Replace("<strong>", ""); return html; } |
|