Skip to content Skip to sidebar Skip to footer

Get Text Followed By Certain Text

I need to get the text but only before the certain text ('---------------'). E.g. example of HTML code: ...

This is correct text. Everything after it is wrong

&

Solution 1:

This XPath will select the text of a p whose immediately following sibling contains ---:

//p[following-sibling::p[contains(.,'---')]][1]/text()

Post a Comment for "Get Text Followed By Certain Text"