Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 54BAA634061 for ; Wed, 24 Mar 2010 17:39:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 34164-01-3 for ; Wed, 24 Mar 2010 20:39:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp1.tech.numericable.fr (smtp1.tech.numericable.fr [82.216.111.37]) by mail.postgresql.org (Postfix) with ESMTP id E719763454C for ; Wed, 24 Mar 2010 17:38:33 -0300 (ADT) Received: from [10.0.1.2] (abo-102-217-68.trs.modulonet.fr [85.68.217.102]) by smtp1.tech.numericable.fr (Postfix) with ESMTP id 9B9BAE0821; Wed, 24 Mar 2010 21:38:31 +0100 (CET) Cc: pgsql-sql@postgresql.org, Robert Manning , squirrel-sql-users@lists.sourceforge.net Message-Id: <27234E40-2601-43F2-8321-5D3ED37A21F6@numericable.fr> From: John Gage To: Josh Kupershmidt In-Reply-To: <4ec1cf761003241213p26d5bccesdaf5283dda2725ca@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Dollar quoted strings Date: Wed, 24 Mar 2010 21:38:30 +0100 References: <20100324140832.GA5864@apartia.fr> <4ec1cf761003241213p26d5bccesdaf5283dda2725ca@mail.gmail.com> X-Mailer: Apple Mail (2.936) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/193 X-Sequence-Number: 33900 Thanks very much for this. I am using 8.4.2. This query works as you describe in pgAdmin. I had tried it in the SquirrelSQL client, which is where it produced the result. Obviously, this is a SquirrelSQL problem at least in part. What does mean? Thanks again for directing me to the doc's on dollar quoting. John On Mar 24, 2010, at 8:13 PM, Josh Kupershmidt wrote: > On Wed, Mar 24, 2010 at 2:38 PM, John Gage wrote: >> In going through the arcana of string functions, I have come across >> the >> following series of selects that contain, for me, a mysterious "$re >> $". >> >> -- return all matches from regexp >> SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$); > > The $re$ is just an arbitrary identifier for a dollar-quoted string > constant. See: > > http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html > > Maybe you're on an old version which doesn't support dollar-quoted > strings? > > On 8.3 for the above query, I get: > > SELECT regexp_matches('foobarbequebaz', $re$(bar)(beque)$re$); > regexp_matches > ---------------- > {bar,beque} > (1 row) > > Josh