【问题标题】:Get a specific value of a XML type file with REGEX使用 REGEX 获取 XML 类型文件的特定值
【发布时间】:2014-06-27 19:10:50
【问题描述】:

我一直在尝试使用 REGEX 的很多方法,但我无法找到一种方法。 我有一个包含大量 xml 类型数据的文件...我需要检索这个:

一堆数字

尝试了许多不同的方法让它工作,但我没有得到任何工作..只是返回一个空白的 anwser

我最后尝试的代码:

        Dim loc As String = "C:\Users\David\Documents\getconfig.php"
    Dim w As New System.IO.StreamReader(loc)
    Dim test As String = w.ReadToEnd
    Dim r As New Regex("<rss-sync-time>"".*""</<rss-sync-time>")
    Dim matches As MatchCollection = r.Matches(test)

【问题讨论】:

  • 你尝试过 DOM 吗?顺便说一句,您需要向我们展示您要解析什么样的代码

标签: .net regex vb.net


【解决方案1】:

试试这个:

Dim r As New Regex("<rss-sync-time>"".*?""</<rss-sync-time>", RegexOptions.Singleline)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-14
    • 1970-01-01
    • 2021-03-20
    • 2013-09-20
    • 1970-01-01
    相关资源
    最近更新 更多