小编Dan*_*ary的帖子

如何使用 XQuery 中的 Replace() 函数替换一个或多个空白字符?

我需要使用replace()函数在XQuery中用一个破折号替换多个空白字符。

$input: 'abc   def   123'
Desired Output: 'abc-def-123'
Run Code Online (Sandbox Code Playgroud)

我试过:

replace($input, '/s*', '-')
Run Code Online (Sandbox Code Playgroud)

replace($input, '/s.*', '-')
Run Code Online (Sandbox Code Playgroud)

但这些都不起作用。我知道 normalize-space() 但我想要一个更通用的函数。

谢谢!- 丹

regex xquery

3
推荐指数
1
解决办法
3401
查看次数

标签 统计

regex ×1

xquery ×1