Validating user-input to be inserted in regular expressions

Поиск
Список
Период
Сортировка
От Vincenzo Ciancia
Тема Validating user-input to be inserted in regular expressions
Дата
Msg-id ct328q$4ms$1@sea.gmane.org
обсуждение исходный текст
Список pgsql-general
Hi all,

I would like to take user input, which should be interpreted literally, and
put it inside a regular expression, something like

select * from files where path ~ (USER_INPUT || '.*')

How should I escape the user input? I mean: I know that I must insert double
backslashes before special characters (in the sense of regular expressions)
but how to know what these special characters are? Should I find every
possible character in the documentation for regular expressions? Is there a
safer way?

Thanks

Vincenzo Ciancia

--
Please note that I do not read the e-mail address used in the from field but
I read vincenzo_ml at yahoo dot it
Attenzione: non leggo l'indirizzo di posta usato nel campo from, ma leggo
vincenzo_ml at yahoo dot it

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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Bug report in 7.4
Следующее
От: John DeSoi
Дата:
Сообщение: Re: number of rown in a cursor.