这期内容当中小编将会给大家带来有关利用ASP.NET怎么对HTML字符串进行过滤,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
具体代码如下:
///去除HTML标记 /// /// /// 包括HTML的源码 ///已经去除后的文字 public static string GetNoHTMLString(string Htmlstring) { //删除脚本 Htmlstring = Regex.Replace(Htmlstring, @"", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"]*?>.*?", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"]*?>.*? ", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"]*?>.*?", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"]*?>.*? ", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"]*?>.*?", "", RegexOptions.IgnoreCase); str = Regex.Replace(str, @"", "", RegexOptions.IgnoreCase); return str; }
Copyright © 2009-2022 www.wtcwzsj.com 青羊区广皓图文设计工作室(个体工商户) 版权所有 蜀ICP备19037934号