如果输入与提供的正则表达式匹配,则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自定义函数