excessive escaping in regular expression functions - Mailing list pgsql-general

From A.M.
Subject excessive escaping in regular expression functions
Date
Msg-id 5F572960-D55F-49FE-96A6-BCAFB0FFFF9C@themactionfaction.com
Whole thread Raw
Responses Re: excessive escaping in regular expression functions
List pgsql-general
Hello,

The following statement replaces an asterisk in a string with a double-escaped asterisk:
SELECT regexp_replace('*',E'\\*',E'\\\\\\\\\*');

I got this result through experimentation and I am at a loss to explain why so much escaping is necessary for the third
argument.Is there a better way? 

Cheers,
M

pgsql-general by date:

Previous
From: araza@esri.com
Date:
Subject: How to get TimeZone name?
Next
From: Michael Glaesemann
Date:
Subject: Re: excessive escaping in regular expression functions