How can i escape a '+' or a '+' in a regexp ?

Поиск
Список
Период
Сортировка
От Gabriel Fernandez
Тема How can i escape a '+' or a '+' in a regexp ?
Дата
Msg-id 3A96AB19.3C6083DA@unica.edu
обсуждение исходный текст
Ответы Re: How can i escape a '+' or a '+' in a regexp ?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Re: How can i escape a '+' or a '+' in a regexp ?  (Jie Liang <jliang@ipinc.com>)
Re: How can i escape a '+' or a '+' in a regexp ?  ("tjk@tksoft.com" <tjk@tksoft.com>)
Список pgsql-sql
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 :-)






В списке pgsql-sql по дате отправления:

Предыдущее
От: Andrew Perrin
Дата:
Сообщение: Re: sum(bool)?
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: How can i escape a '+' or a '+' in a regexp ?