On Wed, May 15, 2024 at 11:46 AM Robert Haas <robertmh...@gmail.com> wrote:
> On Thu, Apr 4, 2024 at 9:55 AM jian he <jian.universal...@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.