如果輸入與提供的正則運算式匹配,則matches
函數返回true
,否則返回false
。
語法
matches($input, $regex)
輸入參數
$input
- 輸入字串。$regex
- 正則運算式。
示例
XQuery運算式 -
let $input := 'zaixian Simply Easy Learning'
return (matches($input, 'Hello') = true(),
matches($input, 'Y.* S.* E.* L.*') = true()
)
輸出結果如下所示 -
false
true
驗證結果
要測試上述函數,用上面的XQuery運算式替換books.xqy(在XQuery環境設置章節中有說明)的內容,並執行XQueryTester java程式來驗證結果。
上一篇:
XQuery正則運算式
下一篇:
XQuery自定義函數