Skip to content

Commit 6feebcb

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 74cf7d4 commit 6feebcb

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

doc/src/sgml/func.sgml

+20-15
Original file line numberDiff line numberDiff line change
@@ -2573,8 +2573,9 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
25732573
<returnvalue>integer</returnvalue>
25742574
</para>
25752575
<para>
2576-
Returns starting index of specified <parameter>substring</parameter>
2577-
within <parameter>string</parameter>, or zero if it's not present.
2576+
Returns first starting index of the specified
2577+
<parameter>substring</parameter> within
2578+
<parameter>string</parameter>, or zero if it's not present.
25782579
</para>
25792580
<para>
25802581
<literal>position('om' in 'Thomas')</literal>
@@ -2617,7 +2618,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
26172618
<returnvalue>text</returnvalue>
26182619
</para>
26192620
<para>
2620-
Extracts substring matching POSIX regular expression; see
2621+
Extracts the first substring matching POSIX regular expression; see
26212622
<xref linkend="functions-posix-regexp"/>.
26222623
</para>
26232624
<para>
@@ -2636,7 +2637,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
26362637
<returnvalue>text</returnvalue>
26372638
</para>
26382639
<para>
2639-
Extracts substring matching <acronym>SQL</acronym> regular expression;
2640+
Extracts the first substring matching <acronym>SQL</acronym> regular expression;
26402641
see <xref linkend="functions-similarto-regexp"/>. The first form has
26412642
been specified since SQL:2003; the second form was only in SQL:1999
26422643
and should be considered obsolete.
@@ -3116,7 +3117,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
31163117
<returnvalue>text[]</returnvalue>
31173118
</para>
31183119
<para>
3119-
Returns captured substring(s) resulting from the first match of a POSIX
3120+
Returns captured substrings resulting from the first match of a POSIX
31203121
regular expression to the <parameter>string</parameter>; see
31213122
<xref linkend="functions-posix-regexp"/>.
31223123
</para>
@@ -3135,9 +3136,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
31353136
<returnvalue>setof text[]</returnvalue>
31363137
</para>
31373138
<para>
3138-
Returns captured substring(s) resulting from matching a POSIX regular
3139-
expression to the <parameter>string</parameter>; see
3140-
<xref linkend="functions-posix-regexp"/>.
3139+
Returns captured substrings resulting from the first match of a
3140+
POSIX regular expression to the <parameter>string</parameter>,
3141+
or multiple matches if the <literal>g</literal> flag is used;
3142+
see <xref linkend="functions-posix-regexp"/>.
31413143
</para>
31423144
<para>
31433145
<literal>regexp_matches('foobarbequebaz', 'ba.', 'g')</literal>
@@ -3158,8 +3160,10 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
31583160
<returnvalue>text</returnvalue>
31593161
</para>
31603162
<para>
3161-
Replaces substring(s) matching a POSIX regular expression; see
3162-
<xref linkend="functions-posix-regexp"/>.
3163+
Replaces substrings resulting from the first match of a
3164+
POSIX regular expression, or multiple substring matches
3165+
if the <literal>g</literal> flag is used; see <xref
3166+
linkend="functions-posix-regexp"/>.
31633167
</para>
31643168
<para>
31653169
<literal>regexp_replace('Thomas', '.[mN]a.', 'M')</literal>
@@ -3364,7 +3368,7 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
33643368
<returnvalue>integer</returnvalue>
33653369
</para>
33663370
<para>
3367-
Returns starting index of specified <parameter>substring</parameter>
3371+
Returns first starting index of the specified <parameter>substring</parameter>
33683372
within <parameter>string</parameter>, or zero if it's not present.
33693373
(Same as <literal>position(<parameter>substring</parameter> in
33703374
<parameter>string</parameter>)</literal>, but note the reversed
@@ -3965,8 +3969,9 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
39653969
<returnvalue>integer</returnvalue>
39663970
</para>
39673971
<para>
3968-
Returns starting index of specified <parameter>substring</parameter>
3969-
within <parameter>bytes</parameter>, or zero if it's not present.
3972+
Returns first starting index of the specified
3973+
<parameter>substring</parameter> within
3974+
<parameter>bytes</parameter>, or zero if it's not present.
39703975
</para>
39713976
<para>
39723977
<literal>position('\x5678'::bytea in '\x1234567890'::bytea)</literal>
@@ -4892,7 +4897,7 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
48924897
<returnvalue>integer</returnvalue>
48934898
</para>
48944899
<para>
4895-
Returns starting index of specified <parameter>substring</parameter>
4900+
Returns first starting index of the specified <parameter>substring</parameter>
48964901
within <parameter>bits</parameter>, or zero if it's not present.
48974902
</para>
48984903
<para>
@@ -5518,7 +5523,7 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
55185523
<replaceable>pattern</replaceable>)</function>, provides extraction of a
55195524
substring
55205525
that matches a POSIX regular expression pattern. It returns null if
5521-
there is no match, otherwise the portion of the text that matched the
5526+
there is no match, otherwise the first portion of the text that matched the
55225527
pattern. But if the pattern contains any parentheses, the portion
55235528
of the text that matched the first parenthesized subexpression (the
55245529
one whose left parenthesis comes first) is

0 commit comments

Comments
 (0)