注册 登录
编程论坛 ASP技术论坛

如何过滤超级链接

飘带飘 发布于 2007-05-23 10:24, 1021 次点击
开始
<a style="color:#666666" href="http://www.12.com/s1/11/12/20030.htm" target=_blank>小说A</a>
<a style="color:#666666" href="http://www.23.com/s1/1WERWgxing/12/2005.htm" target=_blank>小说B</a>
<a style="color:#666666" href="http://www.45.com/s1/DHDGgxing/11/200508180.htm" target=_blank>小说C</a>
结束



如何把里面的链接过滤掉,也就是最后得到:
开始
小说A
小说B
小说C
结束


3 回复
#2
shdyh9772007-05-23 14:18
很简单,如下:
开始
<a style="color:#666666" href="#" target=_blank>小说A</a>
<a style="color:#666666" href="#" target=_blank>小说B</a>
<a style="color:#666666" href="#" target=_blank>小说C</a>
结束
#3
icebo2007-11-06 18:23
今天我也遇到这样的问题,但是答案肯定不是楼上的说的。也不知道他的意思是什么
因为我需要的基本上是用正则过滤超级链接。自己写的表达式遇到"就执行不了,不知道为什么
可以正确过滤
<a style=color:#666666 href=http://www.12.com/s1/11/12/20030.htm target=_blank>小说A</a>
得到:
小说A
但是
<a style="color:#666666" href="http://www.12.com/s1/11/12/20030.htm" target=_blank>小说A</a>
就不行了。
还是把它顶起来望路过的高手帮忙。如果楼主已经解决了希望贴出来。
#4
icebo2007-11-06 21:00

自己搞顶了。用的一个函数
Function body(wstr)
Dim re
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<a.+?>"
Set Matches =re.Execute(wstr)'开始执行配置
set re=nothing
body=""
For Each Match in Matches
wstr=Replace(wstr,Match.Value,"")
body=wstr
Next
End Function
这样还没有结束,因为</a>没有去掉。你可以再用Replace去掉它。
因为自己很菜,很多问题都是解决了就算了。不会优化,或者延伸。
所以看到我发的技术贴千万就不要再找我了。咱们点到为止。

1