{"Entry":{"collection":"func","key":"regexp-replace","name":"regexp_replace","aliases":[],"metadata":{"changed_in":["8.3","15","18","19"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"8.1"},{"descriptions_changed":true,"doc_overhaul":false,"from":"8.2","group_changed":null,"signatures":{"added":["regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text"],"removed":["regexp_replace ( string text, pattern text, replacement text [,flags text] ) → text"]},"status":"changed","to":"8.3"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":true,"doc_overhaul":false,"from":"14","group_changed":null,"signatures":{"added":["regexp_replace ( string text, pattern text, replacement text [, start integer ] [, flags text ] ) → text","regexp_replace ( string text, pattern text, replacement text, start integer, N integer [, flags text ] ) → text"],"removed":["regexp_replace ( string text, pattern text, replacement text [, flags text ] ) → text"]},"status":"changed","to":"15"},{"descriptions_changed":false,"doc_overhaul":false,"from":"17","group_changed":null,"signatures":{"added":["regexp_replace ( string text, pattern text, replacement text [, flags text ] ) → text","regexp_replace ( string text, pattern text, replacement text, start integer [, N integer [, flags text ] ] ) → text"],"removed":["regexp_replace ( string text, pattern text, replacement text [, start integer ] [, flags text ] ) → text","regexp_replace ( string text, pattern text, replacement text, start integer, N integer [, flags text ] ) → text"]},"status":"changed","to":"18"},{"descriptions_changed":true,"doc_overhaul":false,"from":"18","group_changed":null,"signatures":{"added":["regexp_replace(string, pattern, replacement [, flags]) → text","regexp_replace(string, pattern, replacement, start [, N [, flags]]) → text"],"removed":[]},"status":"changed","to":"19"}],"content_hash":"4dfc9a9b34e654a58bd8f562eebfb354e07d6cfee236de2cdb175f620c4f29bf","derived_content_hash":"dca2d3ddf5afe53631ae012dd99798f08b6280ba147b981f433ead6b22f88c96","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:138a1a2297246185bac0f17789a59927786db84285f5b3bafaabf4bfc99cf941","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"8.1","group":"string","group_label":"String Functions And Operators","groups":["string","matching"],"imported_at":"2026-09-27T17:57:28.397205+08:00","last_version":"20","name":"regexp_replace","name_key":"regexp_replace","position":3032,"present_in":["8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:802e7d3a34dd02b460d3d805d212c7aeb07ebf22a5fdae15b73f06cc2551dc68","receipt_sha256":"7b86ad5d7aa9adbfbbfbcf05572bd78bb4b4bb8c56e4fca27277ebb71b9ebf0b","repair":"wiki-repair-20261023"},"signature":"regexp_replace ( string text, pattern text, replacement text [, flags text ] ) → text","signature_count":4,"slug":"regexp-replace","source_rev":"wiki-repair-20261023:138a1a2297246185bac0f17789a59927786db84285f5b3bafaabf4bfc99cf941","summary":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.1.7.","summary_zh":""}},"Definition":{"Collection":"func","Key":"regexp-replace","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"regexp-replace","SourceRevision":"wiki-repair-20261023:138a1a2297246185bac0f17789a59927786db84285f5b3bafaabf4bfc99cf941","Facts":{"description":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.","description_html":"Replaces the substring that is the first match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if the \u003ccode class=\"literal\"\u003eg\u003c/code\u003e flag is used; see \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第一个与 POSIX 正则表达式 pattern 匹配的子字符串，如果使用了 g 标志，则替换所有这样的匹配；参见第 9.7.3 节。","description_zh_html":"替换第一个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串，如果使用了 \u003ccode class=\"literal\"\u003eg\u003c/code\u003e 标志，则替换所有这样的匹配；参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","doc":{"anchor":"FUNCTIONS-STRING-OTHER","file":"functions-string.html","sha256":"dbe9f91e55c35969d99a8d2697b6f7bd5388a24ccc2b89706a666f176025f1e2","slug":"18"},"documentation_revision":{"inputs":[{"file":"functions-string.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"dbe9f91e55c35969d99a8d2697b6f7bd5388a24ccc2b89706a666f176025f1e2","version":"18.7"},{"file":"functions-string.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"7eecd3bb343149124be0476a539f3c682476eab2a15489a0e0ad06fbb769ea9e","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"},"group":"string","group_label":"字符串函数和操作符","lang":"en","layout":"table-new","pages":["functions-string.html"],"prose_only":false,"signatures":[{"description":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.","description_html":"Replaces the substring that is the first match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if the \u003ccode class=\"literal\"\u003eg\u003c/code\u003e flag is used; see \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第一个与 POSIX 正则表达式 pattern 匹配的子字符串，如果使用了 g 标志，则替换所有这样的匹配；参见第 9.7.3 节。","description_zh_html":"替换第一个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串，如果使用了 \u003ccode class=\"literal\"\u003eg\u003c/code\u003e 标志，则替换所有这样的匹配；参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","examples":[{"expr":"regexp_replace('Thomas', '.[mN]a.', 'M')","result":"ThM"}],"html":"\u003ccode class=\"function\"\u003eregexp_replace\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eflags\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text","zh_from":"same-version-manual"},{"description":"Replaces the substring that is the N'th match to the POSIX regular expression pattern, or all such matches if N is zero, with the search beginning at the start'th character of string. If N is omitted, it defaults to 1. See Section 9.7.3.","description_html":"Replaces the substring that is the \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e'th match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e is zero, with the search beginning at the \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e'th character of \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e. If \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e is omitted, it defaults to 1. See \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第 N 个与 POSIX 正则表达式 pattern 匹配的子字符串；如果 N 为零，则替换所有这样的匹配。搜索从 string 的第 start 个字符开始。如果省略 N，则默认为 1。参见第 9.7.3 节。","description_zh_html":"替换第 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e 个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串；如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e 为零，则替换所有这样的匹配。搜索从 \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e 的第 \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e 个字符开始。如果省略 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e，则默认为 1。参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","examples":[{"expr":"regexp_replace('Thomas', '.', 'X', 3, 2)","result":"ThoXas"},{"expr":"regexp_replace(string=\u003e'hello world', pattern=\u003e'l', replacement=\u003e'XX', start=\u003e1, \"N\"=\u003e2)","result":"helXXo world"}],"html":"\u003ccode class=\"function\"\u003eregexp_replace\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eflags\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"regexp_replace ( string text, pattern text, replacement text, start integer [, N integer [, flags text] ] ) → text","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-string.html","sha256":"0446377e0eccc9299099dc4b4b293204c337e3abefcdc396e9698bc54dd1080b"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-STRING-OTHER","file":"functions-string.html","sha256":"dbe9f91e55c35969d99a8d2697b6f7bd5388a24ccc2b89706a666f176025f1e2","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"regexp-replace","SourceDatabase":"center","Version":"18","Locale":"en","Title":"regexp_replace","Summary":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.","BodyHTML":"Replaces the substring that is the first match to the POSIX regular expression \u003cem\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if the \u003ccode\u003eg\u003c/code\u003e flag is used; see \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" rel=\"nofollow\"\u003eSection 9.7.3\u003c/a\u003e.","SourceRevision":"wiki-repair-20261023:138a1a2297246185bac0f17789a59927786db84285f5b3bafaabf4bfc99cf941","ContentHash":"a2ce83041b930d7e9a5ed31f061b2e8cd1e2be9b55558fa054ca02c705f03fb5","Payload":{"description":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.","description_html":"Replaces the substring that is the first match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if the \u003ccode class=\"literal\"\u003eg\u003c/code\u003e flag is used; see \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","signatures":[{"description":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.","description_html":"Replaces the substring that is the first match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if the \u003ccode class=\"literal\"\u003eg\u003c/code\u003e flag is used; see \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第一个与 POSIX 正则表达式 pattern 匹配的子字符串，如果使用了 g 标志，则替换所有这样的匹配；参见第 9.7.3 节。","description_zh_html":"替换第一个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串，如果使用了 \u003ccode class=\"literal\"\u003eg\u003c/code\u003e 标志，则替换所有这样的匹配；参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","examples":[{"expr":"regexp_replace('Thomas', '.[mN]a.', 'M')","result":"ThM"}],"html":"\u003ccode class=\"function\"\u003eregexp_replace\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eflags\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text","zh_from":"same-version-manual"},{"description":"Replaces the substring that is the N'th match to the POSIX regular expression pattern, or all such matches if N is zero, with the search beginning at the start'th character of string. If N is omitted, it defaults to 1. See Section 9.7.3.","description_html":"Replaces the substring that is the \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e'th match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e is zero, with the search beginning at the \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e'th character of \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e. If \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e is omitted, it defaults to 1. See \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第 N 个与 POSIX 正则表达式 pattern 匹配的子字符串；如果 N 为零，则替换所有这样的匹配。搜索从 string 的第 start 个字符开始。如果省略 N，则默认为 1。参见第 9.7.3 节。","description_zh_html":"替换第 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e 个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串；如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e 为零，则替换所有这样的匹配。搜索从 \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e 的第 \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e 个字符开始。如果省略 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e，则默认为 1。参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","examples":[{"expr":"regexp_replace('Thomas', '.', 'X', 3, 2)","result":"ThoXas"},{"expr":"regexp_replace(string=\u003e'hello world', pattern=\u003e'l', replacement=\u003e'XX', start=\u003e1, \"N\"=\u003e2)","result":"helXXo world"}],"html":"\u003ccode class=\"function\"\u003eregexp_replace\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eflags\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"regexp_replace ( string text, pattern text, replacement text, start integer [, N integer [, flags text] ] ) → text","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"2292079341a91a000760c7422033e3191ffa90339bf1f09272a81e08d974cb3b","Text":"regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text","Returns":"text","Payload":{"description":"Replaces the substring that is the first match to the POSIX regular expression pattern, or all such matches if the g flag is used; see Section 9.7.3.","description_html":"Replaces the substring that is the first match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if the \u003ccode class=\"literal\"\u003eg\u003c/code\u003e flag is used; see \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第一个与 POSIX 正则表达式 pattern 匹配的子字符串，如果使用了 g 标志，则替换所有这样的匹配；参见第 9.7.3 节。","description_zh_html":"替换第一个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串，如果使用了 \u003ccode class=\"literal\"\u003eg\u003c/code\u003e 标志，则替换所有这样的匹配；参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","examples":[{"expr":"regexp_replace('Thomas', '.[mN]a.', 'M')","result":"ThM"}],"html":"\u003ccode class=\"function\"\u003eregexp_replace\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eflags\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":1,"Hash":"c75bb727de651a2700f33dd0dc5f888ce81de25efef1f95d638a960ff652cf08","Text":"regexp_replace ( string text, pattern text, replacement text, start integer [, N integer [, flags text] ] ) → text","Returns":"text","Payload":{"description":"Replaces the substring that is the N'th match to the POSIX regular expression pattern, or all such matches if N is zero, with the search beginning at the start'th character of string. If N is omitted, it defaults to 1. See Section 9.7.3.","description_html":"Replaces the substring that is the \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e'th match to the POSIX regular expression \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e, or all such matches if \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e is zero, with the search beginning at the \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e'th character of \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e. If \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e is omitted, it defaults to 1. See \u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX Regular Expressions\"\u003eSection 9.7.3\u003c/a\u003e.","description_zh":"替换第 N 个与 POSIX 正则表达式 pattern 匹配的子字符串；如果 N 为零，则替换所有这样的匹配。搜索从 string 的第 start 个字符开始。如果省略 N，则默认为 1。参见第 9.7.3 节。","description_zh_html":"替换第 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e 个与 POSIX 正则表达式 \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e 匹配的子字符串；如果 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e 为零，则替换所有这样的匹配。搜索从 \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e 的第 \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e 个字符开始。如果省略 \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e，则默认为 1。参见\u003ca href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3. POSIX正则表达式\"\u003e第 9.7.3 节\u003c/a\u003e。","examples":[{"expr":"regexp_replace('Thomas', '.', 'X', 3, 2)","result":"ThoXas"},{"expr":"regexp_replace(string=\u003e'hello world', pattern=\u003e'l', replacement=\u003e'XX', start=\u003e1, \"N\"=\u003e2)","result":"helXXo world"}],"html":"\u003ccode class=\"function\"\u003eregexp_replace\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epattern\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003ereplacement\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003estart\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eN\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eflags\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e] \u003c/span\u003e] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"regexp_replace ( string text, pattern text, replacement text, start integer [, N integer [, flags text] ] ) → text","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
