asp 地址截取
来源:百度知道 编辑:UC知道 时间:2024/07/05 12:28:28
我想问下 怎么截取网页里的连接
比如 截取
<div class="bc1" id="week-score-list">-----这里面所有的连接----<div>
用什么方法 越简单越好
比如 截取
<div class="bc1" id="week-score-list">-----这里面所有的连接----<div>
用什么方法 越简单越好
使用正则表达式
这得看你的具体的连接是什么样..
有相对路径连接,绝对路径连接
关键是你把要查找的字符贴出来一部分
完整代码:
<%
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches ' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = True ' 设置是否区分字符大小写。
regEx.Global = True ' 设置全局可用性。
Set Matches = regEx.Execute(strng) ' 执行搜索。
For Each Match in Matches ' 遍历匹配集合。
RetStr = RetStr & "|"& Match.Value
Next
RegExpTest = RetStr
End Function
str=":<!--页面底部免责声明--><div id=""ft_ms"" style=""clear:both;"">©2008 Baidu <a href=""https://gsp0.baidu.com/8_UFsjip0QIZ8tyhnq/protocol.html"" class=""c"">消息协议</a></div><!--页面底部免责