regexp_replace double quote

Поиск
Список
Период
Сортировка
От Михаил
Тема regexp_replace double quote
Дата
Msg-id CALSKcLSObY_EVX78c261JQGJx6c2x3c0_HzJc5DXB4NvSXwF3w@mail.gmail.com
обсуждение исходный текст
Ответы Re: regexp_replace double quote  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: regexp_replace double quote  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Hi!

I need to escape double quotes only:
test=# select regexp_replace('"""{Performer,"Boomwacker ""a""
Recording""}"""', '([^"])"{2}([^"])', '\1\"\2', 'g');
                 regexp_replace
-------------------------------------------------
 """{Performer,"Boomwacker \"a"" Recording\"}"""

This is unexpected result.

But when added one symbol to ""a"" the result is right:
test=# select regexp_replace('"""{Performer,"Boomwacker ""a1""
Recording""}"""', '([^"])"{2}([^"])', '\1\"\2', 'g');
                  regexp_replace
--------------------------------------------------
 """{Performer,"Boomwacker \"a1\" Recording\"}"""


I had tested on versions:
 PostgreSQL 9.5.1 on x86_64-pc-linux-gnu, compiled by gcc (Gentoo
4.8.3 p1.1, pie-0.5.9) 4.8.3, 64-bit

And:
 PostgreSQL 9.5.3 on x86_64-apple-darwin, compiled by
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc.
build 5658)
 (LLVM build 2336.11.00), 64-bit

And:
PostgreSQL 9.4.7 on x86_64-unknown-linux-gnu, compiled by gcc
(Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, 64-bit

What`s wrong?

--
---
Regards,
Mikhail


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

Предыдущее
От: Pete Fuller
Дата:
Сообщение: 9.2 to 9.5 pg_upgrade losing data
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: regexp_replace double quote