Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iln0Q-0003Zx-UF for pgsql-general@arkaria.postgresql.org; Mon, 30 Dec 2019 04:50:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iln0N-0000OC-Ly for pgsql-general@arkaria.postgresql.org; Mon, 30 Dec 2019 04:50:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iln0N-0000Kz-35 for pgsql-general@lists.postgresql.org; Mon, 30 Dec 2019 04:50:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iln0I-0006v5-NT for pgsql-general@postgresql.org; Mon, 30 Dec 2019 04:50:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBU4o3hP004205; Sun, 29 Dec 2019 23:50:03 -0500 From: Tom Lane To: PegoraroF10 cc: pgsql-general@postgresql.org 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> Comments: In-reply-to PegoraroF10 message dated "Sun, 29 Dec 2019 17:00:59 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4203.1577681403.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Dec 2019 23:50:03 -0500 Message-ID: <4204.1577681403@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PegoraroF10 writes: > I have to replace ; , " and ' chars in an string putting its corresponde= nt > 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