【问题标题】:Find regular expression between html tags [duplicate]在html标签之间查找正则表达式[重复]
【发布时间】:2019-04-15 05:20:21
【问题描述】:

我正在尝试查找此模式的正则表达式。我尝试了一些方法,但都没有奏效。

我试过这个 </a>(.*?)<a name

<a name="13" class="anchor"></a>
      Some Content here
<a name="14" class="anchor"></a>

所以我的预期结果应该是Some Content here

【问题讨论】:

  • 什么不起作用?你得到了什么?你期待什么?您使用什么语言/工具?

标签: regex sublimetext


【解决方案1】:

这样就可以了:

查找:&lt;/a&gt;\s*\K[\s\S]*?(?=&lt;a name)

说明:

</a>\s*         # </a> followed by 0 or more spaces
\K              # forget all we have seen until this position
[\s\S]*?        # 0 or more any character, including linebreaks
(?=<a name)     # positive lookahead, make sure we have "<a name" after

【讨论】:

    猜你喜欢
    • 2020-11-04
    • 2018-11-10
    • 2020-12-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-16
    • 2015-10-02
    相关资源
    最近更新 更多