Re: add function argument names to regex* functions. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: add function argument names to regex* functions.
Date
Msg-id CA+Tgmobj8HN8-bormKJHpONtFr2wjXbKJS0cTKzrYvVU9KSxHA@mail.gmail.com
Whole thread Raw
In response to Re: add function argument names to regex* functions.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: add function argument names to regex* functions.
List pgsql-hackers
On Wed, May 15, 2024 at 4:13 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
>
> You just broke my brain when you say that you read:
>
> By default, only the first match of the pattern is replaced.  If replace_at is specified and greater than zero, then
thefirst "replace_at - 1" matches are skipped before making a single replacement (i.e., the g flag is ignored when
replace_atis specified.) 
>
> And then say:
>
> I'd expect replace_at to be a character position or something, not an occurrence count.

Ah. What I meant was: if I just saw the parameter name, and not the
documentation, I believe that I would not correctly understand what it
did. I would have had to read the docs. Whereas I'm pretty sure at
some point years ago, I looked up these functions and I saw "N", and I
did understand what that did without needing it explained. If I had
seen "count" or "occurrence" I think I would have understood that
without further explanation, too.

So my point was: to me, N is more self-documenting than replace_at,
and less self-documenting than count or occurrence.

If your mileage varies on that point, so be it!

--
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: add function argument names to regex* functions.
Next
From: Nathan Bossart
Date:
Subject: Re: More performance improvements for pg_dump in binary upgrade mode