VB如何查找网页源代码中的<a>内的信息 再进行提取

2024-12-29 11:48:01
推荐回答(4个)
回答1:

如果不用正则你可以用split去拆分。
如果你的原码为SS

Dim x() As String
Dim id As String, name As String
x = Split(ss, " Dim i As Integer
For i = LBound(x) + 1 To UBound(x)
Dim st() As String
st = Split(x(i), """ target=""_blank"">")

id = st(0)

name = Split(st(1), "
")(0)
Debug.Print id, name

Next

输出结果
1393906525 2月1日生日,,,
1394636220 啊!!!!!

回答2:

利用我的函数GetByDiv即可通过前后文本来分离所夹内容。
MsgBox GetByDiv("我爱中国的大好河山","我","河")

弹出的信息框中是“爱中国的大好”

Function GetByDiv(ByVal code As String, ByVal divBegin As String, divEnd As String) '获取分隔符所夹的内容[完成]
Dim lgStart As Long
Dim lens As Long
Dim lgEnd As Long
lens = Len(divBegin)
lgStart = InStr(1, code, divBegin) + CLng(lens)
lgEnd = InStr(lgStart, code, divEnd)
GetByDiv = Mid(code, lgStart, lgEnd - lgStart)
End Function

回答3:
回答4:

Sorry.
I don't no......