需要fn的Xquery功能:替换用于PostgreSQL

时间:2013-10-25 16:00:11

标签: sql string postgresql xquery

我正在寻找与PostgreSQL一起使用的Xquery函数fn:replace的功能。以下是需要在PostgreSQL中实现的特定XQuery代码:

declare function local:canonical($n as xs:string?) as xs:string? {
  replace(fn:lower-case($n),'[^0-9a-z]','')
  };

目的是将大写字母转换为小写字母并仅保留字母和数字。

1 个答案:

答案 0 :(得分:0)

看起来regexp_replace正是您所寻找的:

http://www.postgresql.org/docs/9.0/static/functions-matching.html

相关问题