From: PegoraroF10 <marcos@f10.com.br>
To: pgsql-general@postgresql.org
Subject: replace single char for string using regexp_replace
Date: Sun, 29 Dec 2019 17:00:59 -0700 (MST)
Message-ID: <1577664059509-0.post@n3.nabble.com> (raw)
I have to replace ; , " and ' chars in an string putting its correspondent
ascii value
I have a
Replace(Replace(Replace(Replace($$Text,with;On'It"$$,',','chr(59)'),';','chr(44)'),'"','chr(34)'),'''','chr(39)')
It works but I would like to call just one Replace.
I tried this but didn“t work
select
regexp_replace($$Text,with;On'It"$$,$$,|;|"|'$$,$$chr(59)|chr(44)|chr(34)|chr(39)$$,'g');
, -> chr(59)
; -> chr(44)
" -> chr(34)
' -> chr (39)
--
Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: marcos@f10.com.br
Subject: Re: replace single char for string using regexp_replace
In-Reply-To: <1577664059509-0.post@n3.nabble.com>
References: <1577664059509-0.post@n3.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox