UNICODE and regex character classes

From: David Norris <danorris(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: UNICODE and regex character classes
Date: 2004-08-04 22:10:01
Message-ID: cb1657590408041510425ddeb9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

All,

I'm trying to create a regular expression that plays nice with UNICODE
strings. I'd like to allow any alphabetic or digit character (as
defined by its UNICODE category) in a username. I've already set the
database's encoding to UNICODE and it's working properly as far as
being able to store and retrieve proper multibyte strings.

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?

I wasn't able to find anything on Google, so I would really be
grateful for suggestions or links to websites that talk about this.

Thanks so much!
--
David Norris
danorris(at)gmail(dot)com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David Norris 2004-08-05 01:24:05 Re: UNICODE and regex character classes
Previous Message Frank Voellmann 2004-08-04 19:30:43 Column name truncation