从html中提取纯文本
作者:互联网
public string StripHT(string strHtml) //从html中提取纯文本
{
Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase);
string strOutput = regex.Replace(strHtml, "");//替换掉"<"和">"之间的内容
strOutput = strOutput.Replace("<", "");
strOutput = strOutput.Replace(">", "");
strOutput = strOutput.Replace(" ", "");
return strOutput;
}
标签:Regex,regex,提取,string,Replace,strHtml,html,文本,strOutput 来源: https://www.cnblogs.com/ly-03-04/p/12171534.html