From d629fcf4b36ca8c1e4e9677745ff7d725433ee19 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 26 Jul 2021 22:54:35 -0400 Subject: [PATCH] doc: for various substring funcs, document if only first match Reported-by: troy@frericks.us Discussion: https://postgr.es/m/162614304115.701.2392941350859387646@wrigleys.postgresql.org Backpatch-through: 13 --- doc/src/sgml/func.sgml | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 32328de46d..afaa8d0d21 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -2626,8 +2626,9 @@ repeat('Pg', 4) PgPgPgPg integer - Returns starting index of specified substring - within string, or zero if it's not present. + Returns first starting index of the specified + substring within + string, or zero if it's not present. position('om' in 'Thomas') @@ -2670,7 +2671,7 @@ repeat('Pg', 4) PgPgPgPg text - Extracts substring matching POSIX regular expression; see + Extracts the first substring matching POSIX regular expression; see . @@ -2685,7 +2686,7 @@ repeat('Pg', 4) PgPgPgPg text - Extracts substring matching SQL regular expression; + Extracts the first substring matching SQL regular expression; see . @@ -3163,7 +3164,7 @@ repeat('Pg', 4) PgPgPgPg text[] - Returns captured substring(s) resulting from the first match of a POSIX + Returns captured substrings resulting from the first match of a POSIX regular expression to the string; see . @@ -3182,9 +3183,10 @@ repeat('Pg', 4) PgPgPgPg setof text[] - Returns captured substring(s) resulting from matching a POSIX regular - expression to the string; see - . + Returns captured substrings resulting from the first match of a + POSIX regular expression to the string, + or multiple matches if the g flag is used; + see . regexp_matches('foobarbequebaz', 'ba.', 'g') @@ -3205,8 +3207,10 @@ repeat('Pg', 4) PgPgPgPg text - Replaces substring(s) matching a POSIX regular expression; see - . + Replaces substrings resulting from the first match of a + POSIX regular expression, or multiple substring matches + if the g flag is used; see . regexp_replace('Thomas', '.[mN]a.', 'M') @@ -3405,7 +3409,7 @@ repeat('Pg', 4) PgPgPgPg integer - Returns starting index of specified substring + Returns first starting index of the specified substring within string, or zero if it's not present. (Same as position(substring in string), but note the reversed @@ -3905,8 +3909,9 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three'); integer - Returns starting index of specified substring - within bytes, or zero if it's not present. + Returns first starting index of the specified + substring within + bytes, or zero if it's not present. position('\x5678'::bytea in '\x1234567890'::bytea) @@ -4751,7 +4756,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three'); integer - Returns starting index of specified substring + Returns first starting index of the specified substring within bits, or zero if it's not present. @@ -5373,7 +5378,7 @@ substring('foobar' from '#"o_b#"%' for '#') NULLpattern), provides extraction of a substring that matches a POSIX regular expression pattern. It returns null if - there is no match, otherwise the portion of the text that matched the + there is no match, otherwise the first portion of the text that matched the pattern. But if the pattern contains any parentheses, the portion of the text that matched the first parenthesized subexpression (the one whose left parenthesis comes first) is