2009-02-23 65 views
-1

我正在製作中,我想只匹配像我想只匹配在正則表達式

<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> 

請幫助

+4

請繼續現有的線程;不要打開重複項。 – 2009-02-23 11:27:44

回答

0

這裏是一個將匹配的表達你所需要的:

[<]{1}\s*[pP]{1}\s*[>]{1}[()a-zA-Z0-9 ]+[<]{1}\s*[pP]{1}\s*[>]{1} 

您可以添加到這一點,你需要的所有字符[() a-zA-Z0-9]。