From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Dian Fay <di(at)nmfay(dot)com>, Jim Nasby <jim(dot)nasby(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: add function argument names to regex* functions. |
Date: | 2024-05-15 19:01:18 |
Message-ID: | CAKFQuwZcJFkmuMHPKnsRhgCx3=WdtSS3T0D+WAEXA7PdYH4ZJg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, May 15, 2024 at 11:46 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Thu, Apr 4, 2024 at 9:55 AM jian he <jian(dot)universality(at)gmail(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-05-15 19:01:25 | Re: [PATCH] Add --syntax to postgres for SQL syntax checking |
Previous Message | Josef Šimánek | 2024-05-15 19:00:05 | Re: [PATCH] Add --syntax to postgres for SQL syntax checking |