From: | "tjk(at)tksoft(dot)com" <tjk(at)tksoft(dot)com> |
---|---|
To: | gabi(at)unica(dot)edu (Gabriel Fernandez) |
Cc: | pgsql-sql(at)postgresql(dot)org (PostgreSQL SQL discussion list) |
Subject: | Re: How can i escape a '+' or a '+' in a regexp ? |
Date: | 2001-02-23 18:14:29 |
Message-ID: | 200102231814.KAA15955@uno.tksoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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 :-)
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Gabriel Fernandez | 2001-02-23 18:25:29 | How can i escape a '+' or a '+' in a regexp ? |
Previous Message | Andrew Perrin | 2001-02-23 16:48:11 | Re: sum(bool)? |