Re: [PATCH] proposal for regexp_count, regexp_instr, regexp_substr and regexp_replace

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gilles Darold <gilles@darold.net>
Cc: Chapman Flack <chap@anastigmatix.net>, er@xs4all.nl, pgsql-hackers@lists.postgresql.org
Date: 2021-08-02T01:02:20Z
Lists: pgsql-hackers
I wrote:
> ... aside from the question of whether
> a too-large subexpression number should be an error or not.

Oh ... poking around some more, I noticed a very nearby precedent.
regexp_replace's replacement string can include \1 to \9 to insert
the substring matching the N'th parenthesized subexpression.  But
if there is no such subexpression, you don't get an error, just
an empty insertion.  So that seems like an argument for not
throwing an error for an out-of-range subexpr parameter.

			regards, tom lane



Commits

  1. doc: More documentation on regular expressions and SQL standard

  2. Add assorted new regexp_xxx SQL functions.