Re: add function argument names to regex* functions.
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: jian he <jian.universality@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter@eisentraut.org>, Dian Fay <di@nmfay.com>,
Jim Nasby <jim.nasby@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-05-15T20:18:53Z
Lists: 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 the first "replace_at - 1" matches are skipped before making a single replacement (i.e., the g flag is ignored when replace_at is 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
Commits
-
Doc: fix text's description of regexp_replace's arguments.
- da4017a694de 18.0 landed
-
Add argument names to the regexp_XXX functions.
- 580f8727ca93 18.0 landed
-
Add assorted new regexp_xxx SQL functions.
- 642433707358 15.0 cited