【发布时间】:2010-10-09 07:09:39
【问题描述】:
我正在制作一个正则表达式,我只想匹配错误的标签,例如:<p> *some text here, some other tags may be here as well but no ending 'p' tag* </p>
<P>Affectionately Inscribed </P><P>TO </P><P>HENRY BULLAR, </P><P>(of the western circuit)<P>PREFACE</P>
在上面相同的文本中,我想得到<P>(of the western circuit)<P> 的结果,并且不应该捕获任何其他内容。我正在使用它,但它不起作用:
<P>[^\(</P>\)]*<P>
请帮忙。
【问题讨论】:
-
请注意,在 HTML 中没有明确关闭的段落标签是 not 错误/无效的。它对 XHTML 无效,但是您必须使用小写标记才能有效。