X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A49679FB210 for ; Sat, 15 Jul 2006 23:22:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26058-01 for ; Sat, 15 Jul 2006 23:22:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id BDF759FB20E for ; Sat, 15 Jul 2006 23:22:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6G2MWNT025327; Sat, 15 Jul 2006 22:22:32 -0400 (EDT) To: "Aaron Bono" cc: "Postgres SQL language list" Subject: Re: Regular Expression in SQL In-reply-to: References: Comments: In-reply-to "Aaron Bono" message dated "Sat, 15 Jul 2006 17:03:23 -0500" Date: Sat, 15 Jul 2006 22:22:32 -0400 Message-ID: <25326.1153016552@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/220 X-Sequence-Number: 25794 "Aaron Bono" writes: > I thought by using the FOR '#' I could specify exactly what part of the > expression I would get but it still grabs the first (...) of the pattern. Hmm ... I think that this is a bug in similar_escape(): it ought to transform parentheses in a SIMILAR pattern into non-capturing parentheses. Until this is fixed, your best bet is to use the POSIX-regexp form of substring(). You can't sneak non-capturing parens through similar_escape, because it'll try to escape the ? ... regards, tom lane