当然这应该属于正常过滤手法,而还有一种过滤HTML标签的最终极手法,则是将一对尖括号及尖括号中的所有字符均替换不显示,该方法对于内容中必须描述有关尖括号内容过滤过头了。 不过,总归是有需要将所有尖括号中内容全部替换的时候,很显然是需要进行正则的,有两种代码,第一种如下: 复制代码 代码如下:Function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(<.[^<]*>)" str=re.replace(str,"") re.Pattern="(</[^<]*>)" str=re.replace(str,"") nohtml=str set re=nothing End Function 第二种: 复制代码 代码如下:Function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="<(.[^>]*)>" str=re.replace(str,"") nohtml=str set re=nothing End Function简单的应用:
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
推荐阅读
aspjpeg 添加水印教程及生成缩略图教程
1、为图片加入水印功能 Dim Jpeg Set Jpeg = Server.CreateObject("Persits.Jpeg") ' 建立对象 Jpeg.Open BlogPath & "/upload/" & FileName ' 图片所在位置 Jpeg.Canvas.Font.Color = &H000000 ' 颜色,这里是设置>>>详细阅读
本文标题:asp 过滤尖括号内所有内容的正则代码
地址:http://www.17bianji.com/kaifa2/ASP/32081.html
1/2 1