asp下去除超鏈接的函數(shù)
更新時間:2009年03月28日 00:15:27 作者:
有時候我們需要去除網(wǎng)頁中的超鏈接,那么就可以使用下面的代碼了
復(fù)制代碼 代碼如下:
<%
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
%>
正則表達式去除鏈接:
復(fù)制代碼 代碼如下:
Function RegRemoveHref(HTMLstr)
Set ra = New RegExp
ra.IgnoreCase = True
ra.Global = True
ra.Pattern = "<A[^>]+>(.+?)<\/A>"
RegRemoveHref = ra.replace(HTMLstr,"$1")
END Function
您可能感興趣的文章:
相關(guān)文章
ASP UTF-8頁面亂碼+GB2312轉(zhuǎn)UTF-8 +生成UTF-8格式的文件(編碼)
ASP動態(tài)網(wǎng)頁下UTF-8頁面亂碼+GB2312轉(zhuǎn)UTF-8 +生成UTF-8格式的文件(編碼)2008-10-10asp中response.write(''中文'')或者js中文亂碼問題
這篇文章主要介紹了asp中response.write('中文')或者js中文亂碼問題,有時候我們需要輸出js也會出現(xiàn)亂碼,這里給出了幾個解決方法,需要的朋友可以參考下2020-03-03PostHttpPage用asp是實現(xiàn)模擬登錄效果的代碼
PostHttpPage用asp是實現(xiàn)模擬登錄效果的代碼...2007-09-09