Skip to content

Commit d629fcf

Browse files
committed
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
1 parent 0a5e708 commit d629fcf

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

doc/src/sgml/func.sgml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2626,8 +2626,9 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
26262626
<returnvalue>integer</returnvalue>
26272627
</para>
26282628
<para>
2629-
Returns starting index of specified <parameter>substring</parameter>
2630-
within <parameter>string</parameter>, or zero if it's not present.
2629+
Returns first starting index of the specified
2630+
<parameter>substring</parameter> within
2631+
<parameter>string</parameter>, or zero if it's not present.
26312632
</para>
26322633
<para>
26332634
<literal>position('om' in 'Thomas')</literal>
@@ -2670,7 +2671,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
26702671
<returnvalue>text</returnvalue>
26712672
</para>
26722673
<para>
2673-
Extracts substring matching POSIX regular expression; see
2674+
Extracts the first substring matching POSIX regular expression; see
26742675
<xref linkend="functions-posix-regexp"/>.
26752676
</para>
26762677
<para>
@@ -2685,7 +2686,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
26852686
<returnvalue>text</returnvalue>
26862687
</para>
26872688
<para>
2688-
Extracts substring matching <acronym>SQL</acronym> regular expression;
2689+
Extracts the first substring matching <acronym>SQL</acronym> regular expression;
26892690
see <xref linkend="functions-similarto-regexp"/>.
26902691
</para>
26912692
<para>
@@ -3163,7 +3164,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
31633164
<returnvalue>text[]</returnvalue>
31643165
</para>
31653166
<para>
3166-
Returns captured substring(s) resulting from the first match of a POSIX
3167+
Returns captured substrings resulting from the first match of a POSIX
31673168
regular expression to the <parameter>string</parameter>; see
31683169
<xref linkend="functions-posix-regexp"/>.
31693170
</para>
@@ -3182,9 +3183,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
31823183
<returnvalue>setof text[]</returnvalue>
31833184
</para>
31843185
<para>
3185-
Returns captured substring(s) resulting from matching a POSIX regular
3186-
expression to the <parameter>string</parameter>; see
3187-
<xref linkend="functions-posix-regexp"/>.
3186+
Returns captured substrings resulting from the first match of a
3187+
POSIX regular expression to the <parameter>string</parameter>,
3188+
or multiple matches if the <literal>g</literal> flag is used;
3189+
see <xref linkend="functions-posix-regexp"/>.
31883190
</para>
31893191
<para>
31903192
<literal>regexp_matches('foobarbequebaz', 'ba.', 'g')</literal>
@@ -3205,8 +3207,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
32053207
<returnvalue>text</returnvalue>
32063208
</para>
32073209
<para>
3208-
Replaces substring(s) matching a POSIX regular expression; see
3209-
<xref linkend="functions-posix-regexp"/>.
3210+
Replaces substrings resulting from the first match of a
3211+
POSIX regular expression, or multiple substring matches
3212+
if the <literal>g</literal> flag is used; see <xref
3213+
linkend="functions-posix-regexp"/>.
32103214
</para>
32113215
<para>
32123216
<literal>regexp_replace('Thomas', '.[mN]a.', 'M')</literal>
@@ -3405,7 +3409,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
34053409
<returnvalue>integer</returnvalue>
34063410
</para>
34073411
<para>
3408-
Returns starting index of specified <parameter>substring</parameter>
3412+
Returns first starting index of the specified <parameter>substring</parameter>
34093413
within <parameter>string</parameter>, or zero if it's not present.
34103414
(Same as <literal>position(<parameter>substring</parameter> in
34113415
<parameter>string</parameter>)</literal>, but note the reversed
@@ -3905,8 +3909,9 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
39053909
<returnvalue>integer</returnvalue>
39063910
</para>
39073911
<para>
3908-
Returns starting index of specified <parameter>substring</parameter>
3909-
within <parameter>bytes</parameter>, or zero if it's not present.
3912+
Returns first starting index of the specified
3913+
<parameter>substring</parameter> within
3914+
<parameter>bytes</parameter>, or zero if it's not present.
39103915
</para>
39113916
<para>
39123917
<literal>position('\x5678'::bytea in '\x1234567890'::bytea)</literal>
@@ -4751,7 +4756,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
47514756
<returnvalue>integer</returnvalue>
47524757
</para>
47534758
<para>
4754-
Returns starting index of specified <parameter>substring</parameter>
4759+
Returns first starting index of the specified <parameter>substring</parameter>
47554760
within <parameter>bits</parameter>, or zero if it's not present.
47564761
</para>
47574762
<para>
@@ -5373,7 +5378,7 @@ substring('foobar' from '#"o_b#"%' for '#') <lineannotation>NULL</lineannotat
53735378
<replaceable>pattern</replaceable>)</function>, provides extraction of a
53745379
substring
53755380
that matches a POSIX regular expression pattern. It returns null if
5376-
there is no match, otherwise the portion of the text that matched the
5381+
there is no match, otherwise the first portion of the text that matched the
53775382
pattern. But if the pattern contains any parentheses, the portion
53785383
of the text that matched the first parenthesized subexpression (the
53795384
one whose left parenthesis comes first) is

0 commit comments

Comments
 (0)