From 64a1f225654f8866422010ff28e0d3384ae4c3af Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 31 Jul 2021 15:35:27 -0400 Subject: [PATCH] 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. --- doc/src/sgml/func.sgml | 86 +++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index d83f39f7cd0..a5b6adc4bb7 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -5377,15 +5377,15 @@ substring('foobar' similar '#"o_b#"%' escape '#') NULL substring - - regexp_replace - regexp_match regexp_matches + + regexp_replace + regexp_split_to_table @@ -5542,46 +5542,6 @@ substring('foobar' from 'o(.)b') o - - The regexp_replace function provides substitution of - new text for substrings that match POSIX regular expression patterns. - It has the syntax - regexp_replace(source, - pattern, replacement - , flags ). - The source string is returned unchanged if - there is no match to the pattern. If there is a - match, the source string is returned with the - replacement string substituted for the matching - substring. The replacement string can contain - \n, where n is 1 - through 9, to indicate that the source substring matching the - n'th parenthesized subexpression of the pattern should be - inserted, and it can contain \& to indicate that the - substring matching the entire pattern should be inserted. Write - \\ if you need to put a literal backslash in the replacement - text. - The flags parameter is an optional text - string containing zero or more single-letter flags that change the - function's behavior. Flag i specifies case-insensitive - matching, while flag g specifies replacement of each matching - substring rather than only the first one. Supported flags (though - not g) are - described in . - - - - Some examples: - -regexp_replace('foobarbaz', 'b..', 'X') - fooXbaz -regexp_replace('foobarbaz', 'b..', 'X', 'g') - fooXX -regexp_replace('foobarbaz', 'b(..)', 'X\1Y', 'g') - fooXarYXazY - - - The regexp_match function returns a text array of 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; + + The regexp_replace function provides substitution of + new text for substrings that match POSIX regular expression patterns. + It has the syntax + regexp_replace(source, + pattern, replacement + , flags ). + The source string is returned unchanged if + there is no match to the pattern. If there is a + match, the source string is returned with the + replacement string substituted for the matching + substring. The replacement string can contain + \n, where n is 1 + through 9, to indicate that the source substring matching the + n'th parenthesized subexpression of the pattern should be + inserted, and it can contain \& to indicate that the + substring matching the entire pattern should be inserted. Write + \\ if you need to put a literal backslash in the replacement + text. + The flags parameter is an optional text + string containing zero or more single-letter flags that change the + function's behavior. Flag i specifies case-insensitive + matching, while flag g specifies replacement of each matching + substring rather than only the first one. Supported flags (though + not g) are + described in . + + + + Some examples: + +regexp_replace('foobarbaz', 'b..', 'X') + fooXbaz +regexp_replace('foobarbaz', 'b..', 'X', 'g') + fooXX +regexp_replace('foobarbaz', 'b(..)', 'X\1Y', 'g') + fooXarYXazY + + + The regexp_split_to_table function splits a string using a POSIX regular expression pattern as a delimiter. It has the syntax -- 2.39.5