Re: Using functions in regexp replace captures

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tim Uckun <timuckun(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using functions in regexp replace captures
Date: 2021-08-05 05:22:54
Message-ID: CAKFQuwa8=+36L2tfODp78s+1NFhdXqgWDvkY1gsrTbdr1QLfSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, August 4, 2021, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

>
> But no, you cannot directly write: f(x, y, g(a)) where a is the
> replacement string because you don’t know what a is when the inner function
> g is evaluated first. You need: f(x, y, g(h(x, y))) where h is the
> matching function, g is the transform, f is the replacement of the third
> argument into the x source text, and y is the pattern. I presume the y is
> going to be the same value here but that isn’t required.
>
>
“a” is actually probably going to be an array of text here, its evaluation
producing the replacement string that f requires. a is not the replacement
string itself.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Luca Ferrari 2021-08-05 06:07:54 autovacuum worker started without a worker entry
Previous Message David G. Johnston 2021-08-05 05:19:28 Re: Using functions in regexp replace captures