pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gabriel Fernandez <gabi@unica.edu>
To: PostgreSQL SQL discussion list <pgsql-sql@postgresql.org>
Subject: How can i escape a '+' or a '+' in a regexp ?
Date: Fri, 23 Feb 2001 18:25:29 +0000
Message-ID: <3A96AB19.3C6083DA@unica.edu> (raw)

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 :-)







view thread (4+ messages)  latest in thread

Message-ID: <3A96AB19.3C6083DA@unica.edu>
Permalink:  ../3A96AB19.3C6083DA@unica.edu/
Also on:    postgresql.org/message-id/3A96AB19.3C6083DA@unica.edu

 · 

reply

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: gabi@unica.edu
  Subject: Re: How can i escape a '+' or a '+' in a regexp ?
  In-Reply-To: <3A96AB19.3C6083DA@unica.edu>
  References: <3A96AB19.3C6083DA@unica.edu>

* 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