Re: add function argument names to regex* functions.
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Robert Haas <robertmhaas@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-15T19:01:18Z
Lists: pgsql-hackers
On Wed, May 15, 2024 at 11:46 AM Robert Haas <robertmhaas@gmail.com> wrote: > On Thu, Apr 4, 2024 at 9:55 AM jian he <jian.universality@gmail.com> > wrote: > > in the regexp_replace explanation section. > > changing "N" to lower-case would be misleading for regexp_replace? > > so I choose "count". > > I don't see why that would be confusing for regexp_replace > specifically, but I think N => count is a reasonable change to make. > However, I don't think this quite works: > > + then the <replaceable>count</replaceable>'th match of the pattern > > An English speaker is more likely to understand what is meant by > "N'th" than what is meant by "count'th". Even if they can guess, it's > kinda strange-looking. I think it needs to be rephrased somehow, but > I'm not sure exactly how. > > I think this confusion goes to show that replacing N with count doesn't work. "replace_at" comes to mind as a better name. 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.) David J.
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