index函数实用教程,网站编辑教程

2018-07-09   来源:实用知识

可以过滤处理html标记,但也保留一个不处理标记的参数

function strip_tags(strHTML, allowedTags)
 
        dim objRegExp, strOutput
        set objRegExp = new regexp
 
        strOutput = strHTML
        allowedTags = "," & lcase(replace(allowedTags, " ", "")) & ","
 
        objRegExp.IgnoreCase = true
        objRegExp.Global = true
        objRegExp.MultiLine = true
        objRegExp.Pattern = "<(.|\n)+?>"
        set matches = objRegExp.execute(strHTML)
        objRegExp.Pattern = "<(/?)(\w+)[^>]*>"
        for each match in matches
                tagName = objRegExp.Replace(match.value, "$2")
                if instr(allowedTags, "," & lcase(tagName) & ",") = 0 then
                        strOutput = replace(strOutput, match.value, "")
                end if
        next
        strip_tags = strOutput
        set objRegExp = nothing
end function

index函数实用教程,网站编辑教程

http://m.tuzhexing.com/zhishi/827046/

展开更多 50 %)
分享

热门关注

高考生填志愿实用知识范文(通用3篇)

实用知识

高二上册数学实用知识点(通用3篇)

实用知识

八年级语文上册实用知识点范文(精选三篇)

实用知识

初二物理上册实用知识点精选三篇

实用知识

消防安全实用知识心得体会【汇编三篇】

实用知识

买什么车最经济实惠,5款大空间实惠实用车型导购

实用知识

出乎意料地好用,索尼XPERIA,Z5,Premium一周体验

实用知识

中国涡轮风扇发动机的第一个成果—WS9秦岭发动机

实用知识

既不要三厢也不喜欢SUV,那你得看看全新高尔夫·嘉旅

实用知识

电磁炮是什么,中国超级电磁炮威力惊人,打穿10米混凝土

实用知识