Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.3/8.9.3) with ESMTP id HAA54874 for ; Sun, 4 Jul 1999 07:07:46 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id 2A5E34B5F5; Sun, 4 Jul 1999 14:07:45 +0300 (IDT) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA256C; Sun, 4 Jul 1999 14:10:43 +0300 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sun, 4 Jul 1999 14:09:33 +0300 To: Peter Eisentraut , pgsql-sql@postgreSQL.org From: Herouth Maoz Subject: Re: [SQL] Escaping w/i regular expressions At 21:07 +0300 on 30/06/1999, Peter Eisentraut wrote: > How do you escape a ' (apostrophe) within a regular expression, so it does > not close off the string? Something like > ... ~ '[0-9.,\']' > does not seem to work. > (Pgsql 6.4.2) Yes, it does work: testing=> select * from test; nm ------------------------------------------------------- This is a regular sentence ending with a full stop. In this sentence there is a 'quoted' word. not a sentence Fi, fye, foe, fam - I smell the blood of an Englishman. There are 10,000 bottles of beer on the wall. (5 rows) testing=> select * from test where nm ~ '[0-9.,\']'; nm ------------------------------------------------------- This is a regular sentence ending with a full stop. In this sentence there is a 'quoted' word. Fi, fye, foe, fam - I smell the blood of an Englishman. There are 10,000 bottles of beer on the wall. (4 rows) See how it didn't match the 'not a sentence'? Now, to make sure, I removed the '.' from your regular expression, so the only thing to match in the 'quoted' row was the quotes: testing=> select * from test where nm ~ '[0-9,\']'; nm ------------------------------------------------------- In this sentence there is a 'quoted' word. Fi, fye, foe, fam - I smell the blood of an Englishman. There are 10,000 bottles of beer on the wall. (3 rows) Convinced? Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma