我正在寻找与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]','')
};
目的是将大写字母转换为小写字母并仅保留字母和数字。
答案 0 :(得分:0)
看起来regexp_replace
正是您所寻找的:
http://www.postgresql.org/docs/9.0/static/functions-matching.html