asp,replace函数使用问题
我这样用replace函数,想去掉字段中所有的html代码,但是总是不成功,连 都去不掉,高手指教。FunctionstripHTML(htmlStr)Dimr...
我这样用replace函数,想去掉字段中所有的html代码,但是总是不成功,连 都去不掉,高手指教。
Function stripHTML(htmlStr)
Dim regEx
SET regEx = New Regexp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "<.+?>"
htmlStr = regEx.Replace(htmlStr,"")
htmlStr = Replace(htmlStr, "<","<")
htmlStr = Replace(htmlStr, ">",">")
htmlStr = Replace(htmlStr, ""," ")
htmlStr = Replace(htmlStr,chr(10),"")
htmlStr = Replace(htmlStr,chr(13),"")
stripHTML = htmlStr
SET regEx = Nothing
End Function
title=stripHTML(title)
连 & nbsp ;都替换不掉 展开
Function stripHTML(htmlStr)
Dim regEx
SET regEx = New Regexp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "<.+?>"
htmlStr = regEx.Replace(htmlStr,"")
htmlStr = Replace(htmlStr, "<","<")
htmlStr = Replace(htmlStr, ">",">")
htmlStr = Replace(htmlStr, ""," ")
htmlStr = Replace(htmlStr,chr(10),"")
htmlStr = Replace(htmlStr,chr(13),"")
stripHTML = htmlStr
SET regEx = Nothing
End Function
title=stripHTML(title)
连 & nbsp ;都替换不掉 展开
1个回答
展开全部
htmlStr = regEx.Replace(htmlStr,"")
这句是什么意思??
这样用:
去掉我不想去写,好想得用Regexp,下面是转换HTML代码:
htmlStr = Replace(htmlStr, "<","<")
htmlStr = Replace(htmlStr, ">",">")
htmlStr = Replace(htmlStr, " "," ")
htmlStr = Replace(htmlStr,"<br>",chr(10))
这句是什么意思??
这样用:
去掉我不想去写,好想得用Regexp,下面是转换HTML代码:
htmlStr = Replace(htmlStr, "<","<")
htmlStr = Replace(htmlStr, ">",">")
htmlStr = Replace(htmlStr, " "," ")
htmlStr = Replace(htmlStr,"<br>",chr(10))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询