文山市官方网站:这段代码是什么意思?!

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/30 07:56:46
function htmltotext(byval nr)
''过滤html字符的
pa=""
strContent=nr

Set regex = New RegExp
regEx.Global = True

regEx.IgnoreCase = False ' 设置是否区分大小写。<BR>

'去掉换行
regEx.Pattern = "\n"
strContent = regEx.Replace(strContent,"")

regEx.Pattern = "<[a-zA-Z]+([ ]|[^\n>]|[%$#@!'])*>"
strContent = regEx.Replace(strContent,"")
regEx.Pattern = "</[a-zA-Z]+>"
strContent = regEx.Replace(strContent,"")
regEx.Pattern = "[ ]+"
strContent = regEx.Replace(strContent," ")

strContent=replace(strContent," ","")

if len(strContent)>1000 then
strContent=left(strContent,1000) & "......"
end if

htmltotext=strContent

end function

通过正则表达式替换HTML标签,变成文字格式

楼上说得对,调用的方法
bb="sdfsdfsdfsdf<><>"
aa=htmltotext(bb)