asp 用正则表达式获取超所有链接问题?

来源:百度知道 编辑:UC知道 时间:2024/07/04 20:17:48
需要asp 用正则表达式获取超所有链接,代码最好完整点。

<%
dim str : str = "<a>2</a><a>3</a>"
dim regex : set regex = new regexp
regex.pattern = "\<a.*?\/a\>"
regex.global =true
dim mat : set mat = regex.execute(str)
dim i
for i=0 to mat.count-1
response.write mat(i)
next
%>

Dim myRegExp, myMatches, myMatch
Set myRegExp = New RegExp
myRegExp.Pattern = "(href=""?)(.*?)(?=""| )"
Set myMatches = myRegExp.Execute(SubjectString)
For Each myMatch In myMatches
'matched text: myMatch.Value
'match start: myMatch.FirstIndex
'match length: myMatch.Length
For I = 1 To myMatch.SubMatches.Count
'backreference text: myMatch.SubMatches(I-1)
response.write myMatch.SubMatches(I-1)
Next
Next