Re: UNICODE and regex character classes
От | Tom Lane |
---|---|
Тема | Re: UNICODE and regex character classes |
Дата | |
Msg-id | 13316.1091673572@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | UNICODE and regex character classes (David Norris <danorris@gmail.com>) |
Ответы |
Re: UNICODE and regex character classes
|
Список | pgsql-novice |
David Norris <danorris@gmail.com> writes: > So I tried this regular expression: > "^[[:alpha:]][[:alpha:][:digit:]_]{2,}$". But :alpha: only matches > "pure" ASCII alphabetics, and [:digit:] only matches ASCII '0' thru > '9'. Is there another named class I can use for this, like > [:unicodealpha:]? If not, what's the best way to achieve this? The regex character classes really ought to be encoding- and locale-aware. Right now they are not, but possibly something similar to what I recently did to the upper/lower/initcap functions would work --- that is, rely on the <wctype.h> C library instead of <ctype.h>. If you feel like working on this, the regex stubs are in src/backend/regex/regc_locale.c, and the upper/lower change is in src/backend/utils/adt/oracle_compat.c: http://developer.postgresql.org/cvsweb.cgi/pgsql-server/src/backend/utils/adt/oracle_compat.c.diff?f=h&r1=text&tr1=1.50&r2=text&tr2=1.53 regards, tom lane
В списке pgsql-novice по дате отправления: