Received: from unica.edu ([195.219.118.134]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1NHNGx67263 for ; Fri, 23 Feb 2001 12:23:16 -0500 (EST) (envelope-from gabi@unica.edu) Received: from unica.edu ([172.20.2.2]) by unica.edu (8.9.3/8.9.3) with ESMTP id SAA11301 for ; Fri, 23 Feb 2001 18:22:19 +0100 Message-ID: <3A96AB19.3C6083DA@unica.edu> Date: Fri, 23 Feb 2001 18:25:29 +0000 From: Gabriel Fernandez X-Mailer: Mozilla 4.7 [en-gb] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: PostgreSQL SQL discussion list Subject: How can i escape a '+' or a '+' in a regexp ? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/360 X-Sequence-Number: 1559 Hi fellows, I'm trying to the following query: select * from areas where titulo ~ '+' or titulo ~ '*' and the answer is: ERROR: regcomp failed with error repetition-operator operand invalid I have tried to escape the '+' and the '*' with a backslash, as follows: select * from areas where titulo ~ '\+' or titulo ~ '\*' but the answer is the same. If I use the LIKE operator, then I have the problem with '%' and '_' :-) As long as the values in the field can contain either '+' or '*' or '%' or '_' I need to escape these characters. How can i do it ? I'm using PostgreSQL 6.5.3 on Linux Red Hat 6.2. Thanks, Gabi :-)