利用正则表达式去掉html代码

using System.Text.RegularExpressions;

// 利用正则表达式去掉"<"和">"之间的内容。

private string StripHT(string strHtml)
{
   Regex regex=new Regex("<.+?>",RegexOptions.IgnoreCase);
   string strOutput=regex.Replace(strHtml,"");
  return strOutput;
 }

// 此方法不太合适,去掉了所有"<"和">"之间的内容。

 

各位有更好的方法,欢迎指点.

原文地址:https://www.cnblogs.com/mvc2014/p/3776048.html