有时候我们需要去除网页中的超链接,那么就可以使用下面的代码了

代码如下: % Function ReplaceUrl2(HTMLstr) Dim n,str1,str2,str3,str4 HTMLstr = Lcase(HTMLstr) For n=1 to Ubound(Split(HTMLstr,'a')) str1 = Instr(HTMLstr,'a') str2 = Instr(str1,HTMLstr,'') HTMLstr = left(HTMLstr,str1-1)/a','') ReplaceUrl2 = HTMLstr Next En

作者: 来源: 时间: 17-11-23 15:54:17


代码如下:
<%
Function ReplaceUrl2(HTMLstr)
Dim n,str1,str2,str3,str4
HTMLstr = Lcase(HTMLstr)
For n=1 to Ubound(Split(HTMLstr,"<a"))
str1 = Instr(HTMLstr,"<a")
str2 = Instr(str1,HTMLstr,">")
HTMLstr = left(HTMLstr,str1-1)&right(HTMLstr,len(HTMLstr)-len(left(HTMLstr,str2)))
HTMLstr = replace (HTMLstr,"</a>","")
ReplaceUrl2 = HTMLstr
Next
End Function
%>


正则表达式去除链接:

代码如下:
Function RegRemoveHref(HTMLstr)
Set ra = New RegExp
ra.IgnoreCase = True
ra.Global = True
ra.Pattern = "<A[^>]+>(.+?)</A>"
RegRemoveHref = http://www.popasp.com/ra.replace(HTMLstr,"$1")
END Function
11
22
33
隐藏区块

会员注册

本功能为预留功能,暂不支持注册 ^_^

Login

社交帐号登陆

使用以下任意帐号可登陆本站

Close section
Close

联系我们

关于5UCMS 您有任何需求 均可以留言给我们