我有一些html,我想要在2个标签之间抓取。但是,嵌套标签存在于html中,所以查找不起作用,因为它会在第一个嵌套div上返回。REGEX模式 - 我如何匹配在html中的某个标签
基本上我想要我的正则表达式来..
匹配一些文字字面上,其次是高达其他文字文本字符串的任何字符。所以我的问题是我如何获得[^ <] *继续匹配,直到它看到下一个div。
如 < DIV ID = “测试”[^ <] * < DIV ID = “test2的”
示例HTML
<div id="test" class="whatever">
<div class="wrapper">
<fieldset>Test</fieldset><div class="testclass">some info</div>
</div>
<!-- end test div--></div>
</div>
<div id="test2" class="endFind">
什么语言是你使用,正则表达式的格式因语言而异。 – Stefan 2012-01-05 03:35:35
[RegEx match open tags but XHTML self-contained tags]可能的重复(http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags) – 2017-01-11 10:56:23