Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNuGy-0001Od-VO for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 09:21:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lNuGx-0003Bw-S1 for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 09:21:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNuGx-0003Bp-K5 for pgsql-hackers@lists.postgresql.org; Sun, 21 Mar 2021 09:21:23 +0000 Received: from 7.mo7.mail-out.ovh.net ([46.105.43.131]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lNuGu-0008V9-WC for pgsql-hackers@lists.postgresql.org; Sun, 21 Mar 2021 09:21:23 +0000 Received: from player159.ha.ovh.net (unknown [10.109.138.21]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id 19BE819A7FB for ; Sun, 21 Mar 2021 10:21:18 +0100 (CET) Received: from darold.net (amontpellier-652-1-149-122.w81-251.abo.wanadoo.fr [81.251.156.122]) (Authenticated sender: gilles@darold.net) by player159.ha.ovh.net (Postfix) with ESMTPSA id 9FAEA1C3EEEBF for ; Sun, 21 Mar 2021 09:21:18 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-103G00521c686b4-2f6a-40f4-917d-0ccbe6c4a7be, 50C7547F5D601A3E3989A845F24776745E1C998C) smtp.auth=gilles@darold.net X-OVh-ClientIp: 81.251.156.122 Subject: Re: [PATCH] proposal for regexp_count, regexp_instr, regexp_substr and regexp_replace To: pgsql-hackers@lists.postgresql.org References: <2292303d-766d-2172-2942-b076a3bb6505@darold.net> From: Gilles Darold Message-ID: Date: Sun, 21 Mar 2021 10:21:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <2292303d-766d-2172-2942-b076a3bb6505@darold.net> Content-Type: multipart/alternative; boundary="------------1354AE3754BEB7AC334D0BBC" Content-Language: fr X-Ovh-Tracer-Id: 1156862156009573276 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrudegvddgtddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefuvfhfhffkffgfgggjtgesrgdtreertdefjeenucfhrhhomhepifhilhhlvghsucffrghrohhlugcuoehgihhllhgvshesuggrrhholhgurdhnvghtqeenucggtffrrghtthgvrhhnpefggfegvdefjeehjeehveevtdejfeefgfeuiedugedtfeeliedtkeeihfefhfdvtdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdhliihlrggsshdrtghomhenucfkpheptddrtddrtddrtddpkedurddvhedurdduheeirdduvddvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepphhlrgihvghrudehledrhhgrrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehgihhllhgvshesuggrrhholhgurdhnvghtpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------1354AE3754BEB7AC334D0BBC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Le 20/03/2021 à 19:48, Gilles Darold a écrit : > > Hi, > > > This is a new version of the patch that now implements all the XQUERY > regexp functions as described in the standard, minus the differences > of PostgerSQL regular expression explain in [1]. > > > The standard SQL describe functions like_regex(), occurrences_regex(), > position_regex(), substring_regex() and translate_regex() which > correspond to the commonly named functions regexp_like(), > regexp_count(), regexp_instr(), regexp_substr() and regexp_replace() > as reported by Chapman Flack in [2]. All these function are > implemented in the patch. Syntax of the functions are: > > > - regexp_like(string, pattern [, flags ]) > > - regexp_count( string, pattern [, position ] [, flags ]) > > - regexp_instr( string, pattern [, position ] [, occurrence ] [, > returnopt ] [, flags ] [, group ]) > > - regexp_substr( string, pattern [, position ] [, occurrence ] [, > flags ] [, group ]) > > - regexp_replace(source, pattern, replacement [, position ] [, > occurrence ] [, flags ]) > > > In addition to previous patch version I have added the regexp()_like > function and extended the existsing regex_replace() function. The > patch documents these functions and adds regression tests for all > functions. I will add it to the commitfest. > > > An other regexp functions regexp_positions() that returns all > occurrences that matched a POSIX regular expression is also developped > by Joel Jacobson, see [2]. This function expands the list of regexp > functions described in XQUERY. > > > [1] > https://www.postgresql.org/docs/13/functions-matching.html#FUNCTIONS-POSIX-REGEXP > > [2] > https://www.postgresql.org/message-id/flat/bf2222d5-909d-408b-8531-95b32f18d4ab%40www.fastmail.com#3ec8ba658eeabcae2ac6ccca33bd1aed > > I would like to see these functions in PG 14 but it is a bit too late, added to commitfest 2021-07. -- Gilles Darold LzLabs GmbH http://www.lzlabs.com/ --------------1354AE3754BEB7AC334D0BBC Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Le 20/03/2021 à 19:48, Gilles Darold a écrit :

Hi,


This is a new version of the patch that now implements all the XQUERY regexp functions as described in the standard, minus the differences of PostgerSQL regular expression explain in [1].


The standard SQL describe functions like_regex(), occurrences_regex(), position_regex(), substring_regex() and translate_regex() which correspond to the commonly named functions regexp_like(), regexp_count(), regexp_instr(), regexp_substr() and regexp_replace() as reported by Chapman Flack in [2]. All these function are implemented in the patch. Syntax of the functions are:


- regexp_like(string, pattern [, flags ])

- regexp_count( string, pattern [, position ] [, flags ])

- regexp_instr( string, pattern [, position ] [, occurrence ] [, returnopt ] [, flags ] [, group ])

- regexp_substr( string, pattern [, position ] [, occurrence ] [, flags ] [, group ])

- regexp_replace(source, pattern, replacement [, position ] [, occurrence ] [, flags ])


In addition to previous patch version I have added the regexp()_like function and extended the existsing regex_replace() function. The patch documents these functions and adds regression tests for all functions. I will add it to the commitfest.


An other regexp functions regexp_positions() that returns all occurrences that matched a POSIX regular expression is also developped by Joel Jacobson, see [2]. This function expands the list of regexp functions described in XQUERY.


[1] https://www.postgresql.org/docs/13/functions-matching.html#FUNCTIONS-POSIX-REGEXP

[2] https://www.postgresql.org/message-id/flat/bf2222d5-909d-408b-8531-95b32f18d4ab%40www.fastmail.com#3ec8ba658eeabcae2ac6ccca33bd1aed



I would like to see these functions in PG 14 but it is a bit too late, added to commitfest 2021-07.


--
Gilles Darold
LzLabs GmbH
http://www.lzlabs.com/

--------------1354AE3754BEB7AC334D0BBC--