Replacer.ReplaceText

Updated on

Replacer.ReplaceText is a Power Query M function that replaces old text in the original text with new text. The function returns a replacer function for use in List.ReplaceValue and Table.ReplaceValue.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Replacer.ReplaceText(
   text as nullable text,
   old as text,
   new as text,
) as nullable text

Description

Replaces the old text in the original text with the new text. This replacer function can be used in List.ReplaceValue and Table.ReplaceValue.

Examples

Replace the text “hE” with “He” in the string “hEllo world”.

// Output: "Hello world"
Replacer.ReplaceText( "hEllo world", "hE", "He" )

Used by

While you can use the Replacer.ReplaceText function by itself, it also works together with:

Other functions related to Replacer.ReplaceText are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/replacer-replacetext