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

BUG #1687: Regular expression problem (II)

From: "Halley Pacheco de Oliveira" <halleypo(at)yahoo(dot)com(dot)br>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1687: Regular expression problem (II)
Date: 2005-05-29 18:18:35
Message-ID: 20050529181835.12094F0AC7@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1687
Logged by:          Halley Pacheco de Oliveira
Email address:      halleypo(at)yahoo(dot)com(dot)br
PostgreSQL version: 7.4 and 8.0
Operating system:   Linux and Windows
Description:        Regular expression problem (II)
Details: 

Maybe it would be easier to see the the problem I'm having with regular
expressions this way:

SELECT '192.168.0.15' SIMILAR TO
'([[:alnum:]_-]+).([[:alnum:]_-]+).([[:alnum:]_]+)';
 ?column?
----------
 t

SELECT '192.168.0.15' SIMILAR TO '([\\w-]+).([\\w-]+).([\\w]+)';
 ?column?
----------
 f

SELECT '192.168.0.15' ~
'^([[:alnum:]_-]+)\\.([[:alnum:]_-]+)\\.([[:alnum:]_]+)$';
 ?column?
----------
 f

SELECT '192.168.0.15' ~ '^(([[:alnum:]_-]+)\\.){2}([[:alnum:]_]+)$';
 ?column?
----------
 f

SELECT '192.168.0.15' ~ '^([\\w-]+)\\.([\\w-]+)\\.([\\w]+)$';
 ?column?
----------
 f

SELECT '192.168.0.15' ~ '^(([\\w-]+)\\.){2}([\\w]+)$';
 ?column?
----------
 f

Why does the first query gives a different output? It is not exactly the
same as the second query and similar to the others?

Responses

pgsql-bugs by date

Next:From: wrobellDate: 2005-05-29 21:08:59
Subject: BUG #1688: inheritance and foreign key creation problem
Previous:From: Bruce MomjianDate: 2005-05-29 13:24:12
Subject: Re: [BUGS] Fwd: Bug#308535: postgresql-client: [psql] manual

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