开发者

Unicode regexp_replace in PostgreSQL [duplicate]

This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

regexp_replace Unicode in PostgreSQL

开发者_JAVA百科

How to regexp_replace for Unicode in PostgreSQL

i read this http://www.regular-expressions.info/unicode.html

select regexp_replace('s4y8sds', '\\p{Number}', '')

or

select regexp_replace('s4y8sds', '\\p{N}', '')

but not work

Thanks


As far as I know Postgres does not understand \p{} (as in the article you have linked). See the docs here http://www.postgresql.org/docs/9.0/static/functions-matching.html

According to this answer, internationalized regular expression in postgresql Unicode is not supported by Postgres in this way.

In case you want to replace numbers with empty string, you can do it like this:

select regexp_replace('s١4y8sd½s', '[0-9١٢٣¼½¾]', '', 'g');
 regexp_replace 
----------------
 sysds
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜