Re: add function argument names to regex* functions.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: add function argument names to regex* functions.
Дата
Msg-id CAKFQuwZcJFkmuMHPKnsRhgCx3=WdtSS3T0D+WAEXA7PdYH4ZJg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: add function argument names to regex* functions.  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: add function argument names to regex* functions.
Список 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.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josef Šimánek
Дата:
Сообщение: Re: [PATCH] Add --syntax to postgres for SQL syntax checking
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Add --syntax to postgres for SQL syntax checking