From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Stuart Peters <s(dot)peters(at)surrey(dot)ac(dot)uk> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Regular expression not working [^xyz] |
Date: | 2000-10-09 23:43:10 |
Message-ID: | Pine.BSF.4.10.10010091635540.22928-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, 2 Oct 2000, Stuart Peters wrote:
> \connect - postgres
> CREATE TABLE "bug" (
> "title" text
> );
> COPY "bug" FROM stdin;
> abcdefghijklm
> nopqrstuvwxyz
> aeiou
> \.
>
>
>
> The following queries work as expected, EXCEPT for [2]. I believe
> that [2] and [3] should return identical results, but [2] simply
> lists ALL titles:
>
> [1] select title from bug where title ~* '[ae]';
>
> Lists titles that contain one of the letters a or e: WORKS
>
> [2] select title from bug where title ~* '[^ae]';
>
> Lists ALL titles rather than those that don't contain a or e:
> DOESN'T WORK
> (Note: 'select title from bug where title ~* '[^a];' does not work either
No, that will match any title with at least one character that is not an
a or e. It you want a match for all characters not a or e it's
~* '^[^ae]*$'
If you were to put into bug a row like a or ae or e, that wouldn't match
on 2, but abcde... would match because there exists a character other than
a or e.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2000-10-10 00:49:48 | Re: BUG in date_part |
Previous Message | Bruce Momjian | 2000-10-09 19:54:51 | Re: Minimal patches for PostgreSQL 7.0b3 on NetBSD/alpha 1.4.1.... |