preceeded我有这个下面的HTML文件的结构:找到一个正规表达式模式没有什么
<table>
<tr class="heading">
<td colspan="2">
<h2 class="groupheader">Public Types</h2>
<!-- I don't want that! We're in a table.-->
</td>
</tr>
<tr>...</tr>
</table>
<h2 class="groupheader">Detailed Description</h2>
<!-- I want all that until the next h2-->
<div class="textblock"><p>Provides the functions to control the generation of a single data log file. </p>
<h4>Example</h4>
<div class="fragment"><div class="line">Test <a href="aaa">stuff</a>();</div>
<div class="line">...</div>
<div class="line">...</div>
</div>
</div> <!-- end of first result -->
<h2 class="groupheader">Member</h2>
<!-- I want all that until the next h2 or hr-->
<a class="anchor"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="...">test</a></td>
</tr>
</table>
</div><div class="memdoc">
<hr><!-- End of 2nd result -->
并用正则表达式,我需要得到所有各标题之间的内容,直到下一个标题或小时标记,预计它是否在表中。
到目前为止,我已经获得了我所有的h2-> h2 | hr内容。它是这样:
(?s)(<h2 class="groupheader">.*?)(<h2|<hr)
我怎么能跳过包含在表中的H2下的内容?我已经尝试用负面看背后,但我没有得到任何地方。
谢谢你的帮助。
似乎你有一些错别字让我无法理解这个问题,你能解决它吗?也许提供一些样本数据和样本输出? –
你需要准确地得到,不明白,请添加一个例子,以及它如何失败 –
我试图澄清我的问题。希望它更好! – Flag