excessive escaping in regular expression functions

Поиск
Список
Период
Сортировка
Искать

excessive escaping in regular expression functions

От:
"A.M." <agentm@themactionfaction.com>
Дата:
Hello,

The following statement replaces an asterisk in a string with a double-escaped asterisk:
SELECT regexp_replace('*',E'\\*',E'\\\\\\\\\*');

I got this result through experimentation and I am at a loss to explain why so much escaping is necessary for the third argument. Is there a better way?

Cheers,
M

Re: excessive escaping in regular expression functions

От:
Michael Glaesemann <grzm@seespotcode.net>
Дата:

On Jan 18, 2011, at 14:52, A.M. wrote:

> Is there a better way?

Use dollar quotes or standard quoting instead of E strings.


Michael Glaesemann
grzm seespotcode net



FAQ