diff options
author | Tom Lane | 2021-07-31 19:35:27 +0000 |
---|---|---|
committer | Tom Lane | 2021-07-31 19:35:27 +0000 |
commit | 64a1f225654f8866422010ff28e0d3384ae4c3af (patch) | |
tree | c0d8b79883a7be0caf03b2a99f4fd9b367304d67 | |
parent | ef12f32c0870b73ab7589ffc178094ac9ba3e84f (diff) |
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.
-rw-r--r-- | doc/src/sgml/func.sgml | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d83f39f7cd..a5b6adc4bb 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -5378,15 +5378,15 @@ substring('foobar' similar '#"o_b#"%' escape '#') <lineannotation>NULL</linea <primary>substring</primary> </indexterm> <indexterm> - <primary>regexp_replace</primary> - </indexterm> - <indexterm> <primary>regexp_match</primary> </indexterm> <indexterm> <primary>regexp_matches</primary> </indexterm> <indexterm> + <primary>regexp_replace</primary> + </indexterm> + <indexterm> <primary>regexp_split_to_table</primary> </indexterm> <indexterm> @@ -5543,46 +5543,6 @@ substring('foobar' from 'o(.)b') <lineannotation>o</lineannotation> </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> The <function>regexp_match</function> function returns a text array of captured substring(s) resulting from the first match of a POSIX regular expression pattern to a string. It has the syntax @@ -5685,6 +5645,46 @@ SELECT col1, (SELECT regexp_matches(col2, '(bar)(beque)')) FROM tab; </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> The <function>regexp_split_to_table</function> function splits a string using a POSIX regular expression pattern as a delimiter. It has the syntax <function>regexp_split_to_table</function>(<replaceable>string</replaceable>, <replaceable>pattern</replaceable> |