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

Re: BUG #1686: Regular expression problem

From: Alvaro Herrera <alvherre(at)surnet(dot)cl>
To: Halley Pacheco de Oliveira <halleypo(at)yahoo(dot)com(dot)br>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1686: Regular expression problem
Date: 2005-05-31 15:15:23
Message-ID: 20050531151522.GC6348@surnet.cl (view raw or flat)
Thread:
Lists: pgsql-bugs
On Sat, May 28, 2005 at 11:22:12PM +0100, Halley Pacheco de Oliveira wrote:

> [third query:]
>
> SELECT '200.222.197.219' SIMILAR TO '([\\w-]+).([\\w-]+).([\\w]+)';
> 
>  ?column?
> ----------
>  f
> (1 row)
>
> Why does the third query gives a different output? It is not exactly the
> same as the first query?

Hmm, you are aware that SIMILAR TO is defined by the SQL standard, so
the rules are not exactly the same as POSIX regexes, right?  I guess the
\w character class (a Perl-ism, I think) is not defined for SIMILAR TO.

(Note that our ~ regexes are powered by code of Tcl's heritage, so you
could check Tcl's manual on regexes.)


Anyway I wonder why you are trying to use regular expressions when you
could be using the INET type; maybe the INET input function if it came
to it.

-- 
Alvaro Herrera (<alvherre[a]surnet.cl>)
"Limítate a mirar... y algun día veras"

In response to

Responses

pgsql-bugs by date

Next:From: Stephan SzaboDate: 2005-05-31 15:31:57
Subject: Re: BUG #1688: inheritance and foreign key creation problem
Previous:From: Tom LaneDate: 2005-05-31 15:13:08
Subject: Re: BUG #1687: Regular expression problem (II)

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