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
i have this following code work in PHP
preg_replace( "/[^\p{Ll}|\p{Lm}|\p{Lo}|\p{Lt}|\p{Lu}|\p{Zs}]/u", "", "string1212.," );
Please help me
For ordinary numbers use
digit
character class as[[:digit:]]
or shorthand\d
:Result:
For other numbers (for example ¼) is not that simple, more precisely as documentation says it's ctype (locale) dependent:
However you could use internal PL/Perl procedural language and write server-side function with wanted Unicode characters classes
\p{}
:Check Chapter 41 from doc for more info how to write such functions.