Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNmCW-00FXHR-TQ for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2024 03:57:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rNmCT-009AAw-MZ for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jan 2024 03:57:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNmCS-009AAT-UK for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2024 03:57:49 +0000 Received: from out-182.mta1.migadu.com ([2001:41d0:203:375::b6]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNmCL-000wlL-CX for pgsql-hackers@lists.postgresql.org; Thu, 11 Jan 2024 03:57:47 +0000 Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nmfay.com; s=key1; t=1704945456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d7ufP0Sx/mrg0DTsIC2uI4dKlof3aEWoPZLAo8MGJ+o=; b=uYUGefJyHU98CaD7qyuuNC+ywF1IEB0BMyPlQzCy3eQc11zNW445B+AVomvFPCICAA0HRG zz7jvRN9zYJkijhtWpOrroR/9IZ5lwC9/a4OeuNfV5NGlg8uokmndVmonGa1P4n089ZrUB 4zydoKYBVVXf4uQC/DMI5MxEc+4HDNBbrfRtryggrjSeNcnpCXn9dz1f4axjIi+k0JLQ8a AHtwWnUq4Cd/SrVnUNoSWihO3Pf9hQ0YgtTO4Nf5WLE3k4O3OQs0kDzbW7bS6bxr0rM4iU KO+wW9luLApGLAbKVwcQbMDoC4o6ucVGEiwO4GTmJWNuwWcK8K59phGjhPXEsQ== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 10 Jan 2024 22:57:33 -0500 Message-Id: Cc: "Jim Nasby" , "Peter Eisentraut" , "PostgreSQL Hackers" Subject: Re: add function argument names to regex* functions. X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Dian Fay" To: "jian he" References: <0eb3a5d7-75d8-4da5-9c88-a93deccdaa03@gmail.com> <75129a34-14da-48aa-9906-42062fe78664@gmail.com> In-Reply-To: X-Migadu-Flow: FLOW_OUT List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed Jan 10, 2024 at 9:18 AM EST, jian he wrote: > On Tue, Jan 9, 2024 at 8:52=E2=80=AFAM Dian Fay wrote: > > > > On Mon Jan 8, 2024 at 9:26 AM EST, jian he wrote: > > > On Mon, Jan 8, 2024 at 8:44=E2=80=AFAM Dian Fay wrote: > > > > The `regexp_replace` summary in table 9.10 is mismatched and still > > > > specifies the first parameter name as `string` instead of `source`. > > > > Since all the other functions use `string`, should `regexp_replace`= do > > > > the same or is this a case where an established "standard" diverges= ? > > > > > > got it. Thanks for pointing it out. > > > > > > in functions-matching.html > > > if I change source to > > > string then > > > there are no markup "string" and markup "string", it's kind of > > > slightly confusing. > > > > > > So does the following refactored description of regexp_replace make s= ense: > > > > > > The string is returned unchanged if > > > there is no match to the pattern. If= there is a > > > match, the string is returned with th= e > > > replacement string substituted for th= e matching > > > substring. The replacement string ca= n contain > > > \n, where > > > n is 1 > > > through 9, to indicate that the source substring matching the > > > n'th parenthesized subexpression of > > > the pattern should be > > > inserted, and it can contain \& to indica= te that the > > > substring matching the entire pattern should be inserted. Write > > > \\ if you need to put a literal backslash in > > > the replacement > > > text. > > > > That change makes sense to me! I'll see about the section refactoring > > after this lands. > > I put the changes into the new patch. Sorry, I missed one minor issue with v2. The replacement on lines 6027-6028 of func.sgml (originally "`n` rows if there are `n` matches") is not needed and could be more confusing since the `n` represents a number, not an argument to `regexp_matches`. I've built v3 and gone over everything else one more time and it looks good.