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

求教,如何将类似的数据组成数组

SkyGull 发布于 2008-08-21 17:20, 966 次点击
如何用asp的方法将类似的数据组成数组

就像小偷程序抓取数据时

<a href="list.asp?id=1">1</a>
<a href="list.asp?id=2">2</a>
<a href="list.asp?id=3">3</a>
<a href="list.asp?id=4">4</a>
<a href="list.asp?id=5">5</a>

把 1 2 3 4 5组成数组?????
7 回复
#2
yms1232008-08-21 21:02
<a href="list.asp?id=1">1</a>
<a href="list.asp?id=2">2</a>
<a href="list.asp?id=3">3</a>
<a href="list.asp?id=4">4</a>
<a href="list.asp?id=5">5
去掉最后的一个</a>
用Split的办法呢?
#3
anlige2008-08-22 09:01
regstr="\<a href\=\""list\.asp\?id\=(\d+)""\>(\d+)\<\/a\>"
#4
hellode2008-08-22 12:54
td=split(tr(a),""">"")
tdx=ubound(td)
#5
SkyGull2008-08-22 16:22
split如果中间加杂了其他标签就会有问题了...还是谢谢
#6
SkyGull2008-08-22 16:22
[bo][un]anlige[/un] 在 2008-8-22 09:01 的发言:[/bo]

regstr="\


这个方法如何显示呢?
#7
大连美女2008-08-22 17:12
美女求教
美女想找个高手请教一下ASP,QQ 86605701  注:自己做过网站会后台设计数据库的联系我
#8
2008-08-22 21:59
split是可以的,不管有啥都是有规律的,改改就行了,如下,没试

dim bb(),aa,i

aa='<a href="list.asp?id=1">1</a><a href="list.asp?id=2">2</a>'
aa=split(aa,"</a><a href=")
i=0
for each a in aa
  Redim Preserve bb(i)
  bb(i)=split(split(a,"id=")(1),"""")(0)
  i=i+1
next




以下为正则表达式
public Function matc(strng,patrn)
    Dim regEx, Match, Matches
    Dim i, RetStr()
    i = 0
    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
        Redim Preserve RetStr(i)
        RetStr(i) = Match.Value
        i = i + 1
    Next
    matc = RetStr
End Function

[[it] 本帖最后由 BOSS级菜鸟 于 2008-8-22 22:02 编辑 [/it]]
1