mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 15:41:17 +02:00
Doc: alphabetize the regexp_foo() function descriptions in 9.7.3.
For no visible reason (other than historical accident no doubt), regexp_replace() was out of order. Re-order to match the way that these functions are listed in 9.4. (That means substring() remains first, because it's SQL-standard and the rest aren't.) I've not touched the text other than to move it. This is just to reduce confusion in the diffs for upcoming additions.
This commit is contained in:
parent
ef12f32c08
commit
64a1f22565
@ -5377,15 +5377,15 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea
|
|||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>substring</primary>
|
<primary>substring</primary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
<indexterm>
|
|
||||||
<primary>regexp_replace</primary>
|
|
||||||
</indexterm>
|
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>regexp_match</primary>
|
<primary>regexp_match</primary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>regexp_matches</primary>
|
<primary>regexp_matches</primary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
|
<indexterm>
|
||||||
|
<primary>regexp_replace</primary>
|
||||||
|
</indexterm>
|
||||||
<indexterm>
|
<indexterm>
|
||||||
<primary>regexp_split_to_table</primary>
|
<primary>regexp_split_to_table</primary>
|
||||||
</indexterm>
|
</indexterm>
|
||||||
@ -5542,46 +5542,6 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation>
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
|
||||||
The <function>regexp_replace</function> function provides substitution of
|
|
||||||
new text for substrings that match POSIX regular expression patterns.
|
|
||||||
It has the syntax
|
|
||||||
<function>regexp_replace</function>(<replaceable>source</replaceable>,
|
|
||||||
<replaceable>pattern</replaceable>, <replaceable>replacement</replaceable>
|
|
||||||
<optional>, <replaceable>flags</replaceable> </optional>).
|
|
||||||
The <replaceable>source</replaceable> string is returned unchanged if
|
|
||||||
there is no match to the <replaceable>pattern</replaceable>. If there is a
|
|
||||||
match, the <replaceable>source</replaceable> string is returned with the
|
|
||||||
<replaceable>replacement</replaceable> string substituted for the matching
|
|
||||||
substring. The <replaceable>replacement</replaceable> string can contain
|
|
||||||
<literal>\</literal><replaceable>n</replaceable>, where <replaceable>n</replaceable> is 1
|
|
||||||
through 9, to indicate that the source substring matching the
|
|
||||||
<replaceable>n</replaceable>'th parenthesized subexpression of the pattern should be
|
|
||||||
inserted, and it can contain <literal>\&</literal> to indicate that the
|
|
||||||
substring matching the entire pattern should be inserted. Write
|
|
||||||
<literal>\\</literal> if you need to put a literal backslash in the replacement
|
|
||||||
text.
|
|
||||||
The <replaceable>flags</replaceable> parameter is an optional text
|
|
||||||
string containing zero or more single-letter flags that change the
|
|
||||||
function's behavior. Flag <literal>i</literal> specifies case-insensitive
|
|
||||||
matching, while flag <literal>g</literal> specifies replacement of each matching
|
|
||||||
substring rather than only the first one. Supported flags (though
|
|
||||||
not <literal>g</literal>) are
|
|
||||||
described in <xref linkend="posix-embedded-options-table"/>.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
Some examples:
|
|
||||||
<programlisting>
|
|
||||||
regexp_replace('foobarbaz', 'b..', 'X')
|
|
||||||
<lineannotation>fooXbaz</lineannotation>
|
|
||||||
regexp_replace('foobarbaz', 'b..', 'X', 'g')
|
|
||||||
<lineannotation>fooXX</lineannotation>
|
|
||||||
regexp_replace('foobarbaz', 'b(..)', 'X\1Y', 'g')
|
|
||||||
<lineannotation>fooXarYXazY</lineannotation>
|
|
||||||
</programlisting>
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <function>regexp_match</function> function returns a text array of
|
The <function>regexp_match</function> function returns a text array of
|
||||||
captured substring(s) resulting from the first match of a POSIX
|
captured substring(s) resulting from the first match of a POSIX
|
||||||
@ -5684,6 +5644,46 @@ SELECT col1, (SELECT regexp_matches(col2, '(bar)(beque)')) FROM tab;
|
|||||||
</para>
|
</para>
|
||||||
</tip>
|
</tip>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
The <function>regexp_replace</function> function provides substitution of
|
||||||
|
new text for substrings that match POSIX regular expression patterns.
|
||||||
|
It has the syntax
|
||||||
|
<function>regexp_replace</function>(<replaceable>source</replaceable>,
|
||||||
|
<replaceable>pattern</replaceable>, <replaceable>replacement</replaceable>
|
||||||
|
<optional>, <replaceable>flags</replaceable> </optional>).
|
||||||
|
The <replaceable>source</replaceable> string is returned unchanged if
|
||||||
|
there is no match to the <replaceable>pattern</replaceable>. If there is a
|
||||||
|
match, the <replaceable>source</replaceable> string is returned with the
|
||||||
|
<replaceable>replacement</replaceable> string substituted for the matching
|
||||||
|
substring. The <replaceable>replacement</replaceable> string can contain
|
||||||
|
<literal>\</literal><replaceable>n</replaceable>, where <replaceable>n</replaceable> is 1
|
||||||
|
through 9, to indicate that the source substring matching the
|
||||||
|
<replaceable>n</replaceable>'th parenthesized subexpression of the pattern should be
|
||||||
|
inserted, and it can contain <literal>\&</literal> to indicate that the
|
||||||
|
substring matching the entire pattern should be inserted. Write
|
||||||
|
<literal>\\</literal> if you need to put a literal backslash in the replacement
|
||||||
|
text.
|
||||||
|
The <replaceable>flags</replaceable> parameter is an optional text
|
||||||
|
string containing zero or more single-letter flags that change the
|
||||||
|
function's behavior. Flag <literal>i</literal> specifies case-insensitive
|
||||||
|
matching, while flag <literal>g</literal> specifies replacement of each matching
|
||||||
|
substring rather than only the first one. Supported flags (though
|
||||||
|
not <literal>g</literal>) are
|
||||||
|
described in <xref linkend="posix-embedded-options-table"/>.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Some examples:
|
||||||
|
<programlisting>
|
||||||
|
regexp_replace('foobarbaz', 'b..', 'X')
|
||||||
|
<lineannotation>fooXbaz</lineannotation>
|
||||||
|
regexp_replace('foobarbaz', 'b..', 'X', 'g')
|
||||||
|
<lineannotation>fooXX</lineannotation>
|
||||||
|
regexp_replace('foobarbaz', 'b(..)', 'X\1Y', 'g')
|
||||||
|
<lineannotation>fooXarYXazY</lineannotation>
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <function>regexp_split_to_table</function> function splits a string using a POSIX
|
The <function>regexp_split_to_table</function> function splits a string using a POSIX
|
||||||
regular expression pattern as a delimiter. It has the syntax
|
regular expression pattern as a delimiter. It has the syntax
|
||||||
|
Loading…
Reference in New Issue
Block a user