<td nowrap class="content_padding" valign="top">1</td>
<td nowrap class="content_padding" valign="top">1/141138</td>
<td nowrap class="content_padding" valign="top">要想返回到的是红色字符。谢谢。

解决方案 »

  1.   

    <td nowrap class="content_padding" valign="top">1</td>
    <td nowrap class="content_padding" valign="top">1/141138</td>
    <td nowrap class="content_padding" valign="top">
     
    <td nowrap class="content_padding" valign="top">2</td>
    <td nowrap class="content_padding" valign="top">1/141140</td>
    <td nowrap class="content_padding" valign="top">
     
    分别返回到 text1  和 text2 
    红色部分。
      

  2.   

    另外,源码里面的 1</td>  2</td> 位置是固定的。
      

  3.   

    按文本文件进行读取吧,下面只是一个思路,可能还要按需修改~~~~Private Sub Command1_Click()
    Open "d:\test.txt" For Input As #1
    Do While Not EOF(1)
        Line Input #1, inputdata
        If rigth(Trim(inputdata),6) = "1</td>" Then
            Line Input #1, inputdata
            Text1.Text = mid(inputdata,instr(1,inputdata,">")+1,8)
        End If
        If rigth(Trim(inputdata),6) = "2</td>" Then
            Line Input #1, inputdata
            Text2.Text = mid(inputdata,instr(1,inputdata,">")+1,8)
            Exit do
        End If
    Loop
    Close #1
    End Sub
      

  4.   

    没用VB解析过HTML,不知道有现成的库不。笨方法,我的话就把 "< >" 里面的东西都给替换成空格,然后就好办了。 尖括号要成对计算。
      

  5.   

    我现在是把源码读取到了textbox里面,现在就是想法解析出来。
      

  6.   

    上代码:
    '此代码由“正则测试工具 v1.1.34”自动生成,请直接调用TestReg过程
    Private Sub TestReg()
        Dim strData As String
        Dim reg As Object
        Dim matchs As Object, match As Object    strData = "<td nowrap class=""content_padding"" valign=""top"">1</td>"  &  vbCrLf  & _
                  "<td nowrap class=""content_padding"" valign=""top"">1/141138</td>"  &  vbCrLf  & _
                  "<td nowrap class=""content_padding"" valign=""top"">"  &  vbCrLf  & _
                  "<td nowrap class=""content_padding"" valign=""top"">2</td>"  &  vbCrLf  & _
                  "<td nowrap class=""content_padding"" valign=""top"">1/141140</td>"  &  vbCrLf  & _
                  "<td nowrap class=""content_padding"" valign=""top"">"    Set reg = CreateObject("vbscript.regExp")
        reg.Global = True
        reg.IgnoreCase = True
        reg.MultiLine = True
        reg.Pattern = ">(\d+/\d+)</td>"
        Set matchs = reg.Execute(strData)
        For Each match In matchs
            'Debug.Print match.Value
            Debug.Print match.SubMatches(0)
        Next
    End Sub
      

  7.   

    正则表达式速查 正则表达式举例 正则表达式学习 http://download.csdn.net/source/1808549
      

  8.   

    能不能解释下 reg.Pattern = ">(\d+/\d+)</td>"
    的意思呢?