Prometheus
Prometheus

Reputation: 1241

is it possible to combine the contains() function in Xpath?

I want to get a text that contains the word "com" but not to contain the word "blog" . Is it possible for these two conditions to be combined ?

example :

<html>
www.games.com
www.gamerblog.com
www.sports.com
</html>

result = [www.games.com , www.sports.com]

Upvotes: 0

Views: 136

Answers (1)

sideshowbarker
sideshowbarker

Reputation: 88066

Use logical NOT with logical AND with two separate contains calls:

contains(., "com") and not(contains(., "blog"))

Upvotes: 1

Related Questions