pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Mario Splivalo <mario.splivalo@mobart.hr>
Cc: pgsql-sql@postgresql.org
Subject: Re: Postgres regexp matching failure?
Date: Tue, 5 Sep 2006 11:17:22 -0400
Message-ID: <20060905151722.GD21195@alvh.no-ip.org> (raw)
In-Reply-To: <1157468633.10784.0.camel@localhost.localdomain>
References: <1157451491.27799.6.camel@localhost.localdomain>
	<bf05e51c0609050642p590b8a7euc581ffd52119e4ce@mail.gmail.com>
	<1157465870.27799.39.camel@localhost.localdomain>
	<20060905142115.GC21195@alvh.no-ip.org>
	<1157468633.10784.0.camel@localhost.localdomain>

Mario Splivalo wrote:
> On Tue, 2006-09-05 at 10:21 -0400, Alvaro Herrera wrote:
> > 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 ...)
> > 
> 
> I know this might not be the right place for this question, but, how
> come (or better: why?) is above regexp macthed ok (ok as in 'the way I
> expected') when employed from java/perl/python?

In Perl at least, \b is a word boundary.  In PostgreSQL (and probably
Tcl as well) it's a backslash AFAICT.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (11+ messages)  latest in thread

Message-ID: <20060905151722.GD21195@alvh.no-ip.org>
Permalink:  ../20060905151722.GD21195@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20060905151722.GD21195@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@commandprompt.com, mario.splivalo@mobart.hr
  Subject: Re: Postgres regexp matching failure?
  In-Reply-To: <20060905151722.GD21195@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox