Re: UNICODE and regex character classes - Mailing list pgsql-novice

From Tom Lane
Subject Re: UNICODE and regex character classes
Date
Msg-id 13316.1091673572@sss.pgh.pa.us
Whole thread Raw
In response to UNICODE and regex character classes  (David Norris <danorris@gmail.com>)
Responses Re: UNICODE and regex character classes
List 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 by date:

Previous
From: David Norris
Date:
Subject: Re: UNICODE and regex character classes
Next
From: Oliver Fromme
Date:
Subject: Re: Column name truncation