From 75a64eeb4b9dc4ad790ddc87f1f8357c2049576a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 10 Jul 2005 04:54:33 +0000 Subject: 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 --- doc/src/sgml/func.sgml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'doc/src') 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 @@ @@ -1256,6 +1256,26 @@ PostgreSQL documentation 'O''Reilly' + + regexp_replace(source text, + pattern text, + replacement text + , flags text) + text + Replace string that matches the regular expression + pattern in source to + replacement. + replacement can use \1-\9 and \&. + \1-\9 is a back reference to the n'th subexpression, and + \& is the entire matched string. + flags can use g(global) and i(ignore case). + When flags is not specified, case sensitive matching is used, and it replaces + only the instance. + + regexp_replace('1112223333', '(\\d{3})(\\d{3})(\\d{4})', '(\\1) \\2-\\3') + (111) 222-3333 + + repeat(string text, number integer) text -- cgit v1.2.3