Re: add function argument names to regex* functions.

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dian Fay <di(at)nmfay(dot)com>
Cc: Jim Nasby <jim(dot)nasby(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: add function argument names to regex* functions.
Date: 2024-01-10 14:18:00
Message-ID: CACJufxHqg0xqq=OdfN8Pf0C_hvEf0OSXik_3Yr0-QTAFUuHG=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 9, 2024 at 8:52 AM Dian Fay <di(at)nmfay(dot)com> wrote:
>
> On Mon Jan 8, 2024 at 9:26 AM EST, jian he wrote:
> > On Mon, Jan 8, 2024 at 8:44 AM Dian Fay <di(at)nmfay(dot)com> wrote:
> > > The `regexp_replace` summary in table 9.10 is mismatched and still
> > > specifies the first parameter name as `string` instead of `source`.
> > > Since all the other functions use `string`, should `regexp_replace` do
> > > the same or is this a case where an established "standard" diverges?
> >
> > got it. Thanks for pointing it out.
> >
> > in functions-matching.html
> > if I change <replaceable>source</replaceable> to
> > <replaceable>string</replaceable> then
> > there are no markup "string" and markup "string", it's kind of
> > slightly confusing.
> >
> > So does the following refactored description of regexp_replace make sense:
> >
> > The <replaceable>string</replaceable> is returned unchanged if
> > there is no match to the <replaceable>pattern</replaceable>. If there is a
> > match, the <replaceable>string</replaceable> is returned with the
> > <replaceable>replacement</replaceable> string substituted for the matching
> > substring. The <replaceable>replacement</replaceable> string can contain
> > <literal>\</literal><replaceable>n</replaceable>, where
> > <replaceable>n</replaceable> is 1
> > through 9, to indicate that the source substring matching the
> > <replaceable>n</replaceable>'th parenthesized subexpression of
> > the pattern should be
> > inserted, and it can contain <literal>\&amp;</literal> to indicate that the
> > substring matching the entire pattern should be inserted. Write
> > <literal>\\</literal> if you need to put a literal backslash in
> > the replacement
> > text.
>
> That change makes sense to me! I'll see about the section refactoring
> after this lands.

I put the changes into the new patch.

Attachment Content-Type Size
v3-0001-add-function-argument-names-to-regex.-functions.patch text/x-patch 19.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2024-01-10 14:29:29 Re: Improve WALRead() to suck data directly from WAL buffers when possible
Previous Message Joe Conway 2024-01-10 14:17:13 Re: System username in pg_stat_activity