当前位置: 编程技术>.net/c#/asp.net
去除HTML标签删除HTML示例代码
来源: 互联网 发布时间:2014-08-25
本文导语: 代码如下: /// /// 去除HTML标签 /// /// /// public static string DeleteHTML(string Htmlstring) { //删除HTML Htmlstring = Regex.Replace(Htmlstring, @"]*)>", "", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"([rn])[s]+", "", RegexOptions.IgnoreCase); Htmlstring = R...
代码如下:
///
/// 去除HTML标签
///
///
///
public static string DeleteHTML(string Htmlstring)
{
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([rn])[s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"