Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xpath

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

like image 816
TMichel Avatar asked Apr 08 '12 11:04

TMichel


1 Answers

Use:

following-sibling::text()[contains(., 'needle')]
like image 128
Dimitre Novatchev Avatar answered Sep 21 '22 04:09

Dimitre Novatchev