0

Possible Duplicate:
regexp_replace Unicode in PostgreSQL

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

0

1 Answer 1

0

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
Sign up to request clarification or add additional context in comments.

2 Comments

I'm working with Unicode. so if i have number in other format like Roman(Ⅱ Ⅲ Ⅳ), Arabic(١ ٢ ٣ ٤) and Other(¼ ½ ¾). regexp_replace('s4y8sds', E'\\d+', '', 'g') cant work
@Thessa, thanks for clarifying your question. I'll update the answer in a minute.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.