2016-04-03 155 views

回答

0

這是一個例子列出所有的<td>內容:

Sub MatchXMLtags() 
    Dim xml As String 
    xml = "<td>a</td><td>b" & vbCrLf & "</td><td>c</td>" & vbCrLf & "<td>d</td>" 

    Dim match As Object 
    With CreateObject("VBScript.RegExp") 
    .pattern = "<td>\s*([\S\s]+?)\s*</td>" 
    .Global = True 
    .IgnoreCase = True 
    .MultiLine = False 

    ' display the content of each td tag 
    For Each match In .Execute(xml) 
     Debug.Print match.SubMatches(0) 
    Next 
    End With 
End Sub 
相關問題