Text.Replace
A text with every occurrence of one piece of text replaced by another.
Group: Text and characters. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Text.Replace(text as nullable text, old as text, new as text) as nullable text
| Parameter | Type | Description |
|---|---|---|
text | nullable text | The text to work on; null gives null. |
old | text | The text to find; case counts. |
new | text | What to put in its place. |
Returns
nullable text. The text with every occurrence replaced.
Examples
A city renamed
Text.Replace("Oslo, Oslo S", "Oslo", "Bergen")
"Bergen, Bergen S"
Case counts
Text.Replace("Oslo", "oslo", "Bergen")
"Oslo"
Nothing is replaced.
Related functions
Text.ReplaceRange, Text.Remove, Replacer.ReplaceText, Table.ReplaceValue.