您的位置:首页 > Web前端 > HTML

.net(C#)从html中提取中文字_正则表达式

2014-12-17 12:51 393 查看
using System.Text.RegularExpressions;

private 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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: