following-sibling::text() only if contains needle

xpath

Solution

Use:

following-sibling::text()[contains(., 'needle')]

Problem

In PHP-Xpath i get text between `<br />` tags like: ``` //*/br/following-sibling::text() ``` How can i get this text only if contains 'needle'? Something like `br[contains(.,'needle')]` - or - `following-sibling::*contains(.,'needle')/text()` Appreciate any help

Original source