Received: from as.tksoft.com (gyw.com [209.55.67.177] (may be forged)) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f1NJCRx83276 for ; Fri, 23 Feb 2001 14:12:27 -0500 (EST) (envelope-from tjk@tksoft.com) Received: from uno.tksoft.com (smtp3.tksoft.com [192.168.50.56] (may be forged)) by as.tksoft.com (8.8.8/8.8.8) with ESMTP id LAA31623; Fri, 23 Feb 2001 11:23:59 -0800 Received: (from tjk@tksoft.com) by uno.tksoft.com (8.8.8/8.8.8) id KAA15955; Fri, 23 Feb 2001 10:14:29 -0800 From: "tjk@tksoft.com" Message-Id: <200102231814.KAA15955@uno.tksoft.com> Subject: Re: How can i escape a '+' or a '+' in a regexp ? To: gabi@unica.edu (Gabriel Fernandez) Date: Fri, 23 Feb 2001 10:14:29 -0800 (PST) Cc: pgsql-sql@postgresql.org (PostgreSQL SQL discussion list) In-Reply-To: <3A96AB19.3C6083DA@unica.edu> from "Gabriel Fernandez" at Feb 23, 2001 06:25:29 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/364 X-Sequence-Number: 1563 Gabriel, Two backslashes. > select * from areas where titulo ~ '\\+' or titulo ~ '\\*' Troy > > 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 :-) > > > > >