XQuery - replace 函式
replace 函式使用給定的字串替換匹配的輸入字串。
語法
replace($input, $regex, $string)
輸入引數
$input − 輸入字串。
$regex − 正則表示式。
$string - 用於替換原始字串的字串。
示例
XQuery 表示式
let $input := 'Chapter 1 ... Chapter 2' return ( replace($input, "Chapter (\d)", "Section $1.0"))
輸出
Section 1.0 ... Section 2.0
驗證結果
為了測試上述功能,請將 books.xqy(在 環境設定 章節中提到)的內容替換為上述 XQuery 表示式,然後執行 XQueryTester java 程式來驗證結果。
xquery_regular_expressions.htm
廣告