Skip site navigation (1) Skip section navigation (2)

use of / in ~ vs. ~*

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: pgsql-hackers(at)postgresql(dot)org
Subject: use of / in ~ vs. ~*
Date: 2000-09-26 22:00:30
Message-ID: 39D11C7E.C42282CB@tm.ee (view raw or flat)
Thread:
Lists: pgsql-hackers
Can anyone explain why I must make / a character class 
in case-insensitive query in order to match / ?

and then why does it work in plain ~ ?

hannu=> select * from item where path ~* '^/a';
path  
------
/a/b/c
/a/b/d
/a/d/d
/aa/d 
/a/b  
/a/c  
/a/d  
(7 rows)

hannu=> select * from item where path ~ '^/a';
path  
------
/a/b/c
/a/b/d
/a/d/d
/aa/d 
/a/b  
/a/c  
/a/d  
(7 rows)

hannu=> select * from item where path ~* '^/A';
path
----
(0 rows)

hannu=> select * from item where path ~* '^[/]A';
path  
------
/a/b/c
/a/b/d
/a/d/d
/aa/d 
/a/b  
/a/c  
/a/d  
(7 rows)

------------
Hannu

Responses

pgsql-hackers by date

Next:From: Mikheev, VadimDate: 2000-09-26 22:06:48
Subject: RE: [GENERAL] update inside transaction violates unique constraint?
Previous:From: Hannu KrosingDate: 2000-09-26 21:56:05
Subject: Re: RE: [GENERAL] update inside transaction violates unique constraint?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group