aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-07-10 04:54:33 +0000
committerBruce Momjian <bruce@momjian.us>2005-07-10 04:54:33 +0000
commit75a64eeb4b9dc4ad790ddc87f1f8357c2049576a (patch)
tree1a59ab33e18a4f136942520a932e12979cfba11c /doc/src
parent73e2431817fec3d251a517ac185d210fda0ffcd6 (diff)
downloadpostgresql-75a64eeb4b9dc4ad790ddc87f1f8357c2049576a.tar.gz
postgresql-75a64eeb4b9dc4ad790ddc87f1f8357c2049576a.zip
I made the patch that implements regexp_replace again.
The specification of this function is as follows. regexp_replace(source text, pattern text, replacement text, [flags text]) returns text Replace string that matches to regular expression in source text to replacement text. - pattern is regular expression pattern. - replacement is replace string that can use '\1'-'\9', and '\&'. '\1'-'\9': back reference to the n'th subexpression. '\&' : entire matched string. - flags can use the following values: g: global (replace all) i: ignore case When the flags is not specified, case sensitive, replace the first instance only. Atsushi Ogawa
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/func.sgml22
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 4ff434aca87..f274e53c552 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.263 2005/07/06 19:02:52 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.264 2005/07/10 04:54:30 momjian Exp $
PostgreSQL documentation
-->
@@ -1257,6 +1257,26 @@ PostgreSQL documentation
</row>
<row>
+ <entry><literal><function>regexp_replace</function>(<parameter>source</parameter> <type>text</type>,
+ <parameter>pattern</parameter> <type>text</type>,
+ <parameter>replacement</parameter> <type>text</type>
+ <optional>, <parameter>flags</parameter> <type>text</type></optional>)</literal></entry>
+ <entry><type>text</type></entry>
+ <entry>Replace string that matches the regular expression
+ <parameter>pattern</parameter> in <parameter>source</parameter> to
+ <parameter>replacement</parameter>.
+ <parameter>replacement</parameter> can use <literal>\1</>-<literal>\9</> and <literal>\&amp;</>.
+ <literal>\1</>-<literal>\9</> is a back reference to the n'th subexpression, and
+ <literal>\&amp;</> is the entire matched string.
+ <parameter>flags</parameter> can use <literal>g</>(global) and <literal>i</>(ignore case).
+ When flags is not specified, case sensitive matching is used, and it replaces
+ only the instance.
+ </entry>
+ <entry><literal>regexp_replace('1112223333', '(\\d{3})(\\d{3})(\\d{4})', '(\\1) \\2-\\3')</literal></entry>
+ <entry><literal>(111) 222-3333</literal></entry>
+ </row>
+
+ <row>
<entry><literal><function>repeat</function>(<parameter>string</parameter> <type>text</type>, <parameter>number</parameter> <type>integer</type>)</literal></entry>
<entry><type>text</type></entry>
<entry>Repeat <parameter>string</parameter> the specified