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

From Tom Lane
Subject Re: replace single char for string using regexp_replace
Date
Msg-id 4204.1577681403@sss.pgh.pa.us
Whole thread Raw
In response to replace single char for string using regexp_replace  (PegoraroF10 <marcos@f10.com.br>)
List pgsql-general
PegoraroF10 <marcos@f10.com.br> writes:
> 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.

Use translate(), perhaps?

https://www.postgresql.org/docs/current/functions-string.html

            regards, tom lane



pgsql-general by date:

Previous
From: PegoraroF10
Date:
Subject: replace single char for string using regexp_replace
Next
From: Matthias Apitz
Date:
Subject: Re: testing in ESQL/C if a CUSROR "foo" is open?