正则表达式获取特定单词后和引号之间的所有数据

Regex to get all data after certain word and between quotation marks

我有一个包含大量数据的 xml 文件,但它还包含一个 ID 列表,如下所示

<test test-id="014727">
<not-test not-test-id="11111">
<not-test not-test-id="22222">
<not-test not-test-id="3333">
<test test-id="019727">
<test test-id="013727">

到目前为止,我已经搜索了 test-id,它为我提供了所有数字的列表,但它没有过滤掉其他信息。

在 sublime text 中使用正则表达式,如何获取 test-id 之后所有数字的列表?

所以从上面的例子我会有 3 行:

  1. 014727

  2. 019727

  3. 013727

编辑

原始问题已编辑为排除 <not-test not-test-id="11111"> 个节点。修改下面的步骤 2,在搜索查询中的 test-id 之前添加一个 space (</code>)。其余步骤保持不变。</p> <hr> <blockquote> <p>The following keystrokes are for use with Sublime on <strong>OS X</strong>. If someone wants to provide the Windows equivalent, that would be helpful.</p> </blockquote> <ol> <li><kbd>cmd</kbd> - <kbd>f</kbd> 进入搜索模式</li> <li>输入文字<code>test-id

  • opt - 输入匹配当前文件中的所有结果
  • 突出显示 test-id 的每个实例,将光标向右移动 3 个字符 3
  • opt - shift - 到select整个词(本例中的数字)
  • cmd - c 将 selected 文本复制到剪贴板
  • 将插入符号移动到您希望粘贴复制的数字的任何位置,然后按 cmd - v
  • 在上面的 gif 中,我以

    结束
    1. cmd - a 到 select 所有文本
    2. cmd - v 粘贴复制的数字

    这个正则表达式。将搜索多个 test-id 属性,并列出全局匹配项:

    /(?:test-id=")([^"]*)(?:")/g