From: tjk@tksoft.com <tjk@tksoft.com>
To: gabi@unica.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: How can i escape a '+' or a '+' in a regexp ?
Date: Fri, 23 Feb 2001 10:14:29 -0800 (PST)
Message-ID: <200102231814.KAA15955@uno.tksoft.com> (raw)
In-Reply-To: <3A96AB19.3C6083DA@unica.edu>
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 :-)
>
>
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tjk@tksoft.com, gabi@unica.edu
Subject: Re: How can i escape a '+' or a '+' in a regexp ?
In-Reply-To: <200102231814.KAA15955@uno.tksoft.com>
References: <3A96AB19.3C6083DA@unica.edu> <200102231814.KAA15955@uno.tksoft.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox