作家
登录

asp 正则实现清除html文本格式的函数代码

作者: 来源:www.28hudong.com 2013-03-30 08:19:43 阅读 我要评论

复制代码 代码如下:<% '/* 函数名称: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 一些支付接口

99bill: 1.md5.asp 复制代码 代码如下: <% ''''''''' ' @Description: 快钱网关接口范例 ' @Copyright (c) 上海快钱信息服务有限公司 ' @version 2.0 ''''''''' Private Const BITS_TO_A_BYTE = 8 Private Const B>>>详细阅读


本文标题:asp 正则实现清除html文本格式的函数代码

地址:http://www.17bianji.com/kaifa2/ASP/31967.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)