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