[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-05 (世界標準時間)。"],[],[],null,["# REGEXP_REPLACE\n\nReplaces text within the target value.\n\nSample usage\n------------\n\n`REGEXP_REPLACE(Campaign, '(Sale):(Summer)', '\\\\2 \\\\1')`\n\nSyntax\n------\n\n`REGEXP_REPLACE( `\u003cvar translate=\"no\"\u003eX\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003eregular_expression\u003c/var\u003e`, `\u003cvar translate=\"no\"\u003ereplacement\u003c/var\u003e` )`\n\n### Parameters\n\n- \u003cvar translate=\"no\"\u003eX\u003c/var\u003e - a field or expression that includes a field.\n- \u003cvar translate=\"no\"\u003eregular_expression\u003c/var\u003e - a regular expression that matches a portion of \u003cvar translate=\"no\"\u003eX\u003c/var\u003e.\n- \u003cvar translate=\"no\"\u003ereplacement\u003c/var\u003e - the text with which to replace the matched portion of `field_expression`.\\`\n\n### Returns\n\nThe `REGEXP_REPLACE` function returns **Text** values.\n\n### Notes\n\n`REGEXP_REPLACE` returns text where all substrings of \u003cvar translate=\"no\"\u003eX\u003c/var\u003e that match \u003cvar translate=\"no\"\u003eregular_expression\u003c/var\u003e are replaced with *X*.\n\nYou can use backslashed-escaped digits (\\\\1 to \\\\9) within the \u003cvar translate=\"no\"\u003ereplacement\u003c/var\u003e argument to insert text matching the corresponding parenthesized group in the \u003cvar translate=\"no\"\u003eregular_expression\u003c/var\u003e pattern. Use \\\\0 to refer to the entire matching text.\n\nTo search for a literal backslash in your regular expression, you must escape the literal backslash with a second backslash. For example:\n\n`REGEXP_REPLACE('abc', 'b(.)', 'X\\\\1');`\n\nreturns `aXc`.\n\nYou can also use [raw strings](/bigquery/docs/reference/standard-sql/lexical#string_and_bytes_literals) to remove one layer of escaping. For example:\n\n`REGEXP_REPLACE('abc', 'b(.)', r'X\\1');`\n\nThe `REGEXP_REPLACE` function only replaces non-overlapping matches. For example, replacing `ana` within `banana` results in only one replacement, not two.\n\nExamples\n--------\n\nRelated resources\n-----------------\n\n- [Regular expressions in Looker Studio](/looker/docs/studio/regular-expressions-in-looker-studio)\n- [About calculated fields](/looker/docs/studio/about-calculated-fields)\n- [Looker Studio function list](/looker/docs/studio/function-list)"]]