X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 2797F9FB1D7 for ; Tue, 5 Sep 2006 12:19:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 00122-10 for ; Tue, 5 Sep 2006 15:19:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lists.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id 837169FB2B4 for ; Tue, 5 Sep 2006 12:17:31 -0300 (ADT) Received: from alvh.no-ip.org (201-221-202-127.bk11-dsl.surnet.cl [201.221.202.127]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id k85FHRBU007404; Tue, 5 Sep 2006 08:17:28 -0700 Received: by alvh.no-ip.org (Postfix, from userid 1000) id D43EFC295B4; Tue, 5 Sep 2006 11:17:22 -0400 (CLT) Date: Tue, 5 Sep 2006 11:17:22 -0400 From: Alvaro Herrera To: Mario Splivalo Cc: pgsql-sql@postgresql.org Subject: Re: Postgres regexp matching failure? Message-ID: <20060905151722.GD21195@alvh.no-ip.org> Mail-Followup-To: Mario Splivalo , pgsql-sql@postgresql.org References: <1157451491.27799.6.camel@localhost.localdomain> <1157465870.27799.39.camel@localhost.localdomain> <20060905142115.GC21195@alvh.no-ip.org> <1157468633.10784.0.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1157468633.10784.0.camel@localhost.localdomain> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.3, clamav-milter version 0.88.3 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 05 Sep 2006 08:17:28 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200609/27 X-Sequence-Number: 26238 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 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