您现在的位置是:网站首页> 编程资料编程资料
asp 正则实现清除html文本格式的函数代码_应用技巧_
2023-05-25
226人已围观
简介 asp 正则实现清除html文本格式的函数代码_应用技巧_
复制代码 代码如下:
<%
'/* 函数名称:Zxj_ReplaceHtml ClearHtml
'/* 函数语言:VBScript Language
'/* 作 用:清除文件HTML格式函数
'/* 传递参数:Content (注:需要进行清除的内容)
'/* 函数作者:张晓军(古城童话) QQ:382511147
'/* 函数说明:正则匹配(正则表达式)模式进行数据匹配替换
Function ClearHtml(Content)
Content=Zxj_ReplaceHtml("[^>]*;", "", Content)
Content=Zxj_ReplaceHtml("?marquee[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?object[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?param[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?embed[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?table[^>]*>", "", Content)
Content=Zxj_ReplaceHtml(" ","",Content)
Content=Zxj_ReplaceHtml("?tr[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?th[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?p[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?a[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?img[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?tbody[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?li[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?span[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?div[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?th[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?td[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?script[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("(javascript|jscript|vbscript|vbs):", "", Content)
Content=Zxj_ReplaceHtml("on(mouse|exit|error|click|key)", "", Content)
Content=Zxj_ReplaceHtml("<\\?xml[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("<\/?[a-z]+:[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?font[^>]*>", "", Content)
Content=Zxj_ReplaceHtml("?b[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?u[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?i[^>]*>","",Content)
Content=Zxj_ReplaceHtml("?strong[^>]*>","",Content)
ClearHtml=Content
End Function
Function Zxj_ReplaceHtml(patrn, strng,content)
IF IsNull(content) Then
content=""
End IF
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = true ' 设置忽略字符大小写。
regEx.Global = True ' 设置全局可用性。
Zxj_ReplaceHtml=regEx.Replace(content,strng) ' 执行正则匹配
End Function
%>
您可能感兴趣的文章:
相关内容
- asp+ajax仿google搜索提示效果代码_应用技巧_
- ASP 使用jqGrid实现读写删的代码(json)_应用技巧_
- Microsoft VBScript 运行时错误 错误 '800a0005' 无效的过程调用或参数: 'chr'_应用技巧_
- ASP XMLDom在服务器端操作XML文件的主要方法和实现_应用技巧_
- ASP 高亮显示不区分大小写的关键字_应用技巧_
- asp 性能测试报告 学习asp朋友需要了解的东西_应用技巧_
- asp Driver和Provider两种连接字符串连接Access时的区别_数据库相关_
- asp清理缓存的代码_应用技巧_
- Cookies 欺骗漏洞的防范方法(vbs+js 实现)_应用技巧_
- asp自带的内存缓存 application_应用技巧_
