1个回答
展开全部
asp 分段分行和空格还要啊。。。有点难。。
Function RemoveHTML( strText )
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
str = RegEx.Replace(strText, "")
str=replace(str," ","")
RemoveHTML =str
End Function
‘这个是去所有的,当然太多了,那就在这个之前先将asp 分段分行和空格进行替换 <p>替换成{p},</p>替换成{/p},<br>替换成{br},空格替换成{ }
如 str="<p>123<br>"
str=replace(str,"<p>","{/p}")
...
...
str=RemoveHTML(str)
再替换回来
str=replace(str,"{/p}","<p>")
Function RemoveHTML( strText )
Dim RegEx
Set RegEx = New RegExp
RegEx.Pattern = "<[^>]*>"
RegEx.Global = True
str = RegEx.Replace(strText, "")
str=replace(str," ","")
RemoveHTML =str
End Function
‘这个是去所有的,当然太多了,那就在这个之前先将asp 分段分行和空格进行替换 <p>替换成{p},</p>替换成{/p},<br>替换成{br},空格替换成{ }
如 str="<p>123<br>"
str=replace(str,"<p>","{/p}")
...
...
str=RemoveHTML(str)
再替换回来
str=replace(str,"{/p}","<p>")
追问
试过了,不行,段落还是被去掉了,而其他我想要去掉的HTML标签却保留了很多,比如字体
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询