Re: replace inside regexp_replace

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: replace inside regexp_replace
Дата
Msg-id CAKFQuwYXL7WUmALmrM7T=-gKJinc9NR9j04U7Wm-YwGvPxfmTw@mail.gmail.com
обсуждение исходный текст
Ответ на replace inside regexp_replace  (Oliver Kohll <oliver@agilechilli.com>)
Список pgsql-general
On Monday, June 21, 2021, Oliver Kohll <oliver@agilechilli.com> wrote:

select regexp_replace(
'here is [[my text]] to replace and [[some more]]',
E'\\[\\[(.*?)\\]\\]',
replace(E'\\1', ' ', '_'),
'g'
);

Side note, you seldom want to use “E” (escape) string literals with regexes (or in general really) using just the simple literal syntax removes the need for double-backslashing.

David J. 

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