2015-08-28 58 views
0

我想要得到一個包含單詞「com」的文本,但是要包含單詞「blog」,但要包含而不是。這兩個條件是否可以合併?是否可以在Xpath中結合contains()函數?

例如:

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

結果= [www.games.com,www.sports.com]

+0

我已經嘗試了邏輯和和符號,但在一個函數中包含。 – CodeCraft

回答

1

使用邏輯NOT與邏輯AND有兩個分開contains呼叫:

contains(., "com") and not(contains(., "blog")) 
相關問題