From: | Михаил <m(dot)nasedkin(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | regexp_replace double quote |
Date: | 2016-08-15 13:27:06 |
Message-ID: | CALSKcLSObY_EVX78c261JQGJx6c2x3c0_HzJc5DXB4NvSXwF3w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | hubert depesz lubaczewski | 2016-08-15 13:36:50 | Re: regexp_replace double quote |
Previous Message | Pete Fuller | 2016-08-15 13:20:42 | 9.2 to 9.5 pg_upgrade losing data |