Add assorted new regexp_xxx SQL functions.
Tom Lane <tgl@sss.pgh.pa.us>
Add assorted new regexp_xxx SQL functions. This patch adds new functions regexp_count(), regexp_instr(), regexp_like(), and regexp_substr(), and extends regexp_replace() with some new optional arguments. All these functions follow the definitions used in Oracle, although there are small differences in the regexp language due to using our own regexp engine -- most notably, that the default newline-matching behavior is different. Similar functions appear in DB2 and elsewhere, too. Aside from easing portability, these functions are easier to use for certain tasks than our existing regexp_match[es] functions. Gilles Darold, heavily revised by me Discussion: https://postgr.es/m/fc160ee0-c843-b024-29bb-97b5da61971f@darold.net
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +331 −21 |
| src/backend/utils/adt/regexp.c | modified | +455 −18 |
| src/backend/utils/adt/varlena.c | modified | +27 −6 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +64 −0 |
| src/include/utils/varlena.h | modified | +2 −1 |
| src/test/regress/expected/strings.out | modified | +371 −0 |
| src/test/regress/sql/strings.sql | modified | +89 −0 |
Documentation touched
Discussion
- [PATCH] proposal for regexp_count, regexp_instr, regexp_substr and regexp_replace 28 messages · 2021-03-03 → 2021-12-20