0
現在我有一個XPath的搜索功能,如下所示:PHP XPath查詢與包含和正則表達式
$paragraph = $xmldoc->xpath("//p[contains(., '$wordsearch')]");
我想知道是否有可能讓$wordsearch
是一個正則表達式,所以我搜索看着像這樣:
$paragraph = $xmldoc->xpath("//p[contains(., '$regularExpression')]");
感謝您的幫助。
它[不支持](http://stackoverflow.com/questions/405060/can-i-use-a-regex-in-an-xpath-expression),因爲在PHP中,底層庫[只實現XPath 1.0](http://stackoverflow.com/questions/2085632/will-xpath-2-0-and-or-xslt-2-0-be-implemented-in-php)。 – mario
erg,php讓我失望 – Jeff
你可以使用regex來過濾返回數組。 – hakre