Regex 使用正则表达式在html中查找描述性文本块

Regex 使用正则表达式在html中查找描述性文本块,regex,Regex,我正试图弄明白如何使用前瞻来捕获html页面中的描述性文本,例如 <div class="itemBanner" style="float:left; padding:10px"> <div style="padding-right:5px; padding-bottom:5px"> <div class="itemBanner"> HTML Tags Stripper is designed to strip HTML tags from the text.

我正试图弄明白如何使用前瞻来捕获html页面中的描述性文本,例如

<div class="itemBanner" style="float:left; padding:10px">
<div style="padding-right:5px; padding-bottom:5px">
<div class="itemBanner">
HTML Tags Stripper is designed to strip HTML tags from the text. It will also strip embedded JavaScript code, style information (style sheets), as well as code inside php/asp tags (&lt;?php ?&gt; &lt;%php ?&gt; &lt;% %&gt;). It will also replace sequence of new line characters (multiple) with only one. <b>Allow tags</b> feature is session sticky, i.e. it will remember allowed tags list, so you will have to type them only once.<p></p>You can either provide text in text area below, or enter URL of the web page. If URL provided then HTML Tags Stripper will visit web-page for its contents.<p></p>
<b>Known issues:</b><br />

HTML标记剥离器设计用于从文本中剥离HTML标记。它还将剥离嵌入的JavaScript代码、样式信息(样式表)以及php/asp标记内的代码(?php?%php?%%)。它还将仅用一个替换新行字符序列(多个)。“允许标记”功能具有会话粘性,即它将记住“允许标记”列表,因此您只需键入一次。

您可以在下面的文本区域中提供文本,也可以输入网页的URL。如果提供了URL,则HTML标签剥离器将访问网页以获取其内容。

已知问题:

我认为一个正则表达式如果在“之前查找一个“>”并后跟至少150个字符,那么它将匹配任何既不是“.”也不是“.”的正则表达式“不要使用正则表达式解析HTML:@scrowler他不是在解析,他只是在捕获一块文本。解析是正确的方法。”。在本例中,HTML看起来像XHTML,因此可以使用XML解析器。
item_banner_div_regex = /<div class="itemBanner">(.*?)<\/div>/
match = item_banner_div_regex.match(html)
inside_item_banner_div = match && match[1]