检查文件是否包含列表中的项目

时间:2019-11-20 18:09:46

标签: vb.net

我有一个图形名称列表“ graphicList”。我需要在实体字符串中的graphicList中的每个项目中搜索我的文件。我不知道如何引用graphicList中的每个项目并进行搜索。

到目前为止的代码:

    Dim Regex = New Regex("<!ENTITY .*?SYSTEM ""<graphicListItem>"" .*?>")
    Dim strMasterDoc = File.ReadAllText(FileLocation)
    Dim rxMatches = Regex.Matches(strMasterDoc)
    Dim entityList As New List(Of String)

    Dim entityFound As MatchCollection = Regex.Matches(strMasterDoc)

    'For each file's multipled image file references
    For Each m As Match In entityFound
        Dim found As Group = m.Groups(1)
        entityList.Add(found.Value)
    Next

1 个答案:

答案 0 :(得分:0)

我找到了问题的答案

        For Each item As Match In graphicRefList
          Dim found As Group = item.Groups(1)
          GraphicList.Add(found.Value)
          Dim Regex = New Regex("(<!ENTITY " & found.Value & " SYSTEM ""\w.+?\w"" .*?>)")
        Next