replace single char for string using regexp_replace - Mailing list pgsql-general

From PegoraroF10
Subject replace single char for string using regexp_replace
Date
Msg-id 1577664059509-0.post@n3.nabble.com
Whole thread Raw
Responses Re: replace single char for string using regexp_replace
Re: replace single char for string using regexp_replace
List pgsql-general
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



pgsql-general by date:

Previous
From: Jeff Janes
Date:
Subject: Re: Are my autovacuum settings too aggressive for this table?
Next
From: Tom Lane
Date:
Subject: Re: replace single char for string using regexp_replace