Search Postgresql Archives

Regexp matching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I have some problems using character class matching (e.g. [:alpha:]).

For example I have a table:

CREATE TABLE re_test (text_column character varying (50) NOT NULL);

Notice, that there is some specific characters.

INSERT INTO re_test VALUES ('AÅDF');
INSERT INTO re_test VALUES ('AÅDF45');
INSERT INTO re_test VALUES ('AÅDF FDÅA');
INSERT INTO re_test VALUES ('ASDF FDÅA');
INSERT INTO re_test VALUES ('58ASDF FDÅA');
INSERT INTO re_test VALUES ('aÅDf');
INSERT INTO re_test VALUES ('aÅdf');

SELECT * FROM re_test WHERE text_column ~ '[^[:alpha:]]' and text_column ~ [:upper:];

Goal:
I want to write such statement which returns me only those records which have only one word and those words must be uppercase.
So I expect this statemet to return only one record where text_column = AÅDF.

Maybe someone could give me more detail explanation how to use those regexp classes, because the documentation tells very little about this.

Some more information:

PostgreSQL9

OS - Windows x86-32
DB encoding - UTF-8
lc_collate - English_United States.1252
lc_ctype - English_United States.1252
lc_messages - English_United States.1252
lc_monetary - English_United States.1252
lc_numeric - English_United States.1252
lc_time - English_United States.1252


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux