On Monday, June 21, 2021, Oliver Kohll <oliver(at)agilechilli(dot)com> wrote:
>
> select regexp_replace(
> 'here is [[my text]] to replace and [[some more]]',
> E'\\[\\[(.*?)\\]\\]',
> replace(E'\\1', ' ', '_'),
> 'g'
> );
>
Side note, you seldom want to use āEā (escape) string literals with regexes
(or in general really) using just the simple literal syntax removes the
need for double-backslashing.
David J.