Re: Postgres regexp matching failure? - Mailing list pgsql-sql

From Alvaro Herrera
Subject Re: Postgres regexp matching failure?
Date
Msg-id 20060905142115.GC21195@alvh.no-ip.org
Whole thread Raw
In response to Re: Postgres regexp matching failure?  (Mario Splivalo <mario.splivalo@mobart.hr>)
Responses Re: Postgres regexp matching failure?  (Mario Splivalo <mario.splivalo@mobart.hr>)
List pgsql-sql
Mario Splivalo wrote:
> On Tue, 2006-09-05 at 08:42 -0500, Aaron Bono wrote:
> > On 9/5/06, Mario Splivalo <mario.splivalo@mobart.hr> wrote:
> >         
> >         pulitzer2=# select 'stop works' ~ '^\s*(?:[\
> >         +|-]|(?:[sS][tT][oO][pP]\b)).*$';
> >         ?column?
> >         ----------
> >         f
> >         (1 row)
> >         
> >         Here, postgres should return true, but it gives me false.
> > 
> >  
> > \b is a back-space - is that what you are wanting there?  If I remove
> > it I get true.
> 
> Actually, I'm not sure :) As I've mentioned, python/java/perl do as I
> expected, postgres on the other hand doesn't. If \b was the backspace,
> then I'd have trouble with '+mario test', and that one seems to be OK. 

No, because the \b is inside the "stop" arm of the |.  You need to do
*both*, double backslashes and get rid of \b (or at least understand
what you actually mean with it ...)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-sql by date:

Previous
From: Mario Splivalo
Date:
Subject: Re: Postgres regexp matching failure?
Next
From: Tom Lane
Date:
Subject: Re: pg_dump