Power Automate Replace + 21 Examples

In this Power Automate tutorial, we will discuss Power Automate replace function. And also we will discuss the below points:

  • Power automate replace
  • Power automate replace apostrophe in string
  • Power automate replace ampersand
  • Power automate replace string in variable
  • Power automate replace special characters
  • Power automate replace all special characters
  • Power automate replace with empty string
  • Power automate replace array element
  • Power automate replace single quote
  • Power automate replace multiple characters
  • Power automate replace value in array
  • Power automate replace characters
  • Power automate replace carriage return
  • Power automate replace comma
  • Power automate replace comma with carriage return
  • Power automate replace double quote
  • Power automate replace first character
  • Power automate replace last character from string
  • Power automate replace forward slash
  • Power automate replace newline
  • Power automate replace multiple strings
  • Power automate replace with nothing

Power Automate replace function

The Power Automate replace function is used to replace a string with a given string. This function needs a three-parameter.

  • text- the text contains the string to be searched for
  • old text- the string you want to replace by the new text
  • new text- the text replace the old text.

The syntax for replace function

replace( text, old text, new text)

Power automate replace apostrophe in string

Here we will see how to replace apostrophes in a string using Power Automate.

In Power Automate, select the Manually triggered flow and then click on Next step.

Power automate replace apostrophe in string
Power automate replace apostrophe in string

Select initialize variable action, and then provide the variable name, type as string, and value like below.

Replace apostrophe in string in Power Automate
Replace apostrophe in string in Power Automate

Now we will replace the string in a single quote with a double-quote. So click on the Next step and then select Compose action and then in Input write the below expression.

replace(variables('variable'), '''', '"')
Replace apostrophe in string in MS flow
Replace apostrophe in string in MS flow

Now, click on Save and run the flow manually, then you can see the result in the output of compose action.

Power automate replace apostrophe in string example
Power automate replace apostrophe in string example

This is an example of Power automate replace apostrophe in string.

Read Power Automate Set Variable

Power automate replace ampersand

Here we will see Power Automate replace the ampersand.

In Power Automate, select the Manually triggered flow, and then click on Next step.

Power automate replace ampersand
Power automate replace ampersand

Select the Initialize variable action and then provide the variable name, type as a string, and set the value like the below screenshot.

Power automate replace ampersand example
Power automate replace ampersand example

Now we will see, how to replace the ampersand with space, so click on the Next step and then select compose action. Then In input write the below expression:

replace(variables('variable'), '&', ' ')
Microsoft flow replace ampersand
Microsoft flow replace ampersand

Now click on Save and run the flow manually, you can see the result in the output section.

How to replace ampersand in power automate
replace ampersand in power automate

This is an example of Power automate replace ampersand.

Read How to call a flow from another flow in Power Automate

Power automate replace a string in variable

Here we will see how to replace a string in a variable using Power Automate.

In the Power Automate, select the Manually triggered flow, then click on the Next step.

Power automate replace a string in variable
Power automate replace a string in variable

Select the initialize variable action, then provide the variable name, type as a string, and set value like below.

How to replace a string in variable in Power Automate
How to replace a string in variable in Power Automate

Now we will replace a string in a variable, so click on the Next step and select Compose action, and then in Input write the below expression.

replace(variables('ReplaceVariable'), 'Bi','Automate')
Microsoft Flow replace a string in variable
Microsoft Flow replace a string in variable

Now click on Save and run the flow manually, you can see the result in the output of the compose action.

Microsoft Flow replace a string in variable
Microsoft Flow replace a string in variable

This is an example of Microsoft Flow replace a string in a variable.

Read Power Automate wait timer

Power automate replace special characters

Here we will see how to replace special characters with apostrophes using Power Automate.

In Power Automate, select the Manually triggered Flow, then click on Next step.

Power automate replace special characters
Power automate replace special characters

Select the Initialize variable action, and then provide the variable name, type as a string, and set the value.

Power automate replace special characters
Power automate replace special characters

Now we will replace the ‘/’ with apostrophes(”), so click on the Next step and select compose action. Then In input write the below expression:

replace(variables('stringwithspecialCharacter'),'/','''')
Microsoft Flow replace special characters
Microsoft Flow replace special characters

Now click on save and run the flow manually, so you can see the output in the compose action.

How to replace special characters in Power Automate
How to replace special characters in Power Automate

This is an example of Microsoft Flow replace special characters.

Read Power Automate update SharePoint list increment integer field

Power Automate replace all special characters

Here we will see how to replace all special characters from the string in Power Automate.

In Power Automate, select the Manually triggered flow, and then click on Next step.

Power Automate replace all special characters
Power Automate replace all special characters

Now variables contain all special characters, later we will use in Apply to each. And also this variable gets updated with the special characters, that we want to replace with another character or value.

So, select the Initialize variable action, and then give a variable name, type as an array, and in value write the below expression:

createArray('.','@','ß','²','³','µ','`','´','°','^','=','(',')','&','$','§', '~','#','%','*',':','<','>','?','/','|',' ', ' ','{','}','!','+','__','___')
Microsoft flow replace all special characters
Microsoft flow replace all special characters

Now in variable assign, a sample string contains a special character, so click on the Next step. Then select Initialize variable action and provide the variable name, type as string, and set the value like below:

Power Automate replace all special characters
How to replace all special characters in Power Automate

Here we will initialize two variables to hold the values later in apply to each action.

Power Automate replace all special characters
Power Automate replace all special characters

Next, click on the next step and select Apply to each action in the output set the variable ‘special characters’.

Power Automate replace all special characters
Power Automate replace all special characters

Now we will replace the special character in the string with an underscore, so click on the Add an action then select Set variable action, then select the variable name ‘replace special character’, and in values write the below expression:

replace(variables('stringwithspecialcharacter'),item(),'_')
Microsoft Flow replace all special characters
Microsoft Flow replace all special characters

We will remove the repeating character, so click on the Next step and select Set variable action, and then provide the variable name and write the below expression.

replace(variables('replacespecialcharacter'),item(),'_')
Microsoft Flow replace all special characters
Replace all special characters in Power Automate example

Next click on the next step, and select set variable action, then provide the variable name and in value select the ‘replacerepeatcharacter’ from the dynamic content.

Microsoft Flow replace all special characters
Microsoft Flow replace all special characters

To see the result we will use the compose action, so click on Next step and in input select the variable ‘stringwithspecialcharacter’.

power automate replace invalid characters
power automate replace invalid characters

Now click on Save and run the flow manually, now you can see the result in the compose action.

power automate replace invalid characters
power automate replace invalid characters

This is an example of power automate replace special characters.

Read How to move emails to folder after 30 days using Power Automate

Power automate replace with empty string

Here we will see how to replace the value with an empty string in Power Automate.

In Power Automate, select the Manually triggered flow, then click on the next step.

Power automate replace with empty string
Power automate replace with empty string

Select initialize variable action, and then click on the next step and then provide the variable name, type as string, and in value leave empty.

How to replace with empty string in Power Automate
How to replace with empty string in Power Automate

Now if the string is empty, then it will replace the value with 1, or else it will replace with 0. So click on the next step and select compose action. And in input write the below expression:

if(empty(variables('replaceemptystring')),'1','0')
Power automate replace with empty string
Power automate replace with empty string

Now click on save and run the flow manually, you can see the result in the output of the compose action.

Microsoft FLow replace with empty string
Microsoft FLow replace with empty string

This is an example of Power automate replace with empty string.

Check out, Power Automate list rows present in a table filter query

Power automate replace array element

Here we will see how to replace array elements using Power Automate.

For example, if array [12,14,15,16,19,20] and we want to replace 16 with 17 so our new array will be [12,14,15,17,19,20].

In Power Automate, select the Manually triggered flow, and then click on the next step.

Power automate replace array element
Power automate replace array element

Select initialize variable action, and then provide the variable name, type as an array, and set the value with the sample array.

Microsoft flow replace array element
Microsoft flow replace array element

Click on the Next step, select Initialize variable action with type as Integer and array.

Flow replace array element
Flow replace array element

Now, click on the Next step, and select Apply to each action, and in the output set the ArrayOfId.

Power automate replace array element example
Power automate replace array element example

Inside Apply to each, click on Add an action and select Increment variable, and set the variable name as Index, and in value as 1.

How to replace array element in Power Automate
How to replace array element in Power Automate

After that click on the Add an action, and select the Append to array variable action. Then choose the Name as TempNew, and in value write like the below screenshot.

replace array element in Power Automate
replace array element in Power Automate

Now set the array variable as empty, so click on the next step, select Set variable action, and choose the variable name ArrayOfId and value is [].

How to replace array element in Flow
How to replace array element in Flow

Now we will apply to each array variable to replace the value, so click on the Next step and select Apply to each action. In input select the TempNew variable, from the dynamic content.

Replace array element in Microsoft flow
Replace array element in Microsoft flow

Inside Apply to each action, click on the Add an action, and select Condition action, in value write the below expression is equal to 4.

items('Apply_to_each_2')['Index']

If the condition is true, in the If Yes part of the condition, add an action and select Append to array variable2, then select the variable name as ArrayOfId and in value write the below expression.

add(items('Apply_to_each_2')['Value'],1)

And If the condition is false, then in If No part, append the array variable, select the name as ArrayOfId, and in value write the below expression.

items('Apply_to_each_2')['Value']
Power automate replace array element
Power automate replace array element

Next, to see the result, click on the Next step and select Compose action, and in Input select ArrayOfId variable.

How to replace array element in Microsoft flow
How to replace array element in Microsoft flow

Now click on Save and run the flow manually, you can see the result in the compose output. So here element index 4 value 14 gets replaced with 15.

Microsoft flow replace array elements
Microsoft flow replace array element

This is an example of Power automate replace array element.

Read Power Automate get events into excel

Power automate replace single quote

Here we will see how to replace a single quote with a double quote in Power Automate or Microsoft flow.

In Power Automate, select the Manually triggered flow and then click on the Next step.

Power automate replace single quote
Power automate replace single quote

Select Initialize variable action, and then provide the variable name, type as string, and assign a sample value.

How to replace single quote in Power Automate
How to replace single quote in Power Automate

Then click on the Next step, and select the Compose action. Then in input write the below expression.

replace(variables('Tech'),'''','"')
Power automate replace single quote
Power automate replace single quote

Now click on Save and run the flow manually, you can see the result in the compose output.

Microsoft flow replace single quote
Microsoft flow replace single quote

This is an example of Power automate replacing a single quote.

Read Microsoft flow send email based on create date

Power automate replace multiple characters

Here we will see how to replace multiple characters using Power Automate.

For example, a string contains ABC and we want to replace A with 1 and B with 2 and C with 3. So the new string will be 123

In Power Automate, select the Manually triggered Flow and then click on the Next step.

Power automate replace multiple characters
Power automate replace multiple characters

Select Initialize variable action, and then provide the variable name, type as a string, and then assign a sample value.

How to replace multiple characters in Power Automate
How to replace multiple characters in Power Automate

Next, we will replace the value, so click on the Next step and select compose action. Then in Input write the below expression.

replace(replace(variables('Tech'),'Power Automate','SharePoint Online'),'Power Bi','Power Apps')
Microsoft Flow replace multiple characters
Microsoft Flow replace multiple characters

Now click on Save and run the flow manually and you can see the result in the compose output.

Microsoft Flow replace multiple characters
Microsoft Flow replace multiple characters

This is an example of Power automate replacing multiple characters.

Check out, Power Automate or Microsoft Flow check day of week

Power automate replace characters

Here we will see how to replace characters from the string using Power Automate.

In Power Automate, select the Manually triggered flow. And then click on the Next step.

 Power automate replace characters
Power automate replace characters

Select the Initialize variable action, and then set variable name, type as a string and in value assign a value.

How to replace characters in Power automate
How to replace characters in Power automate

Next, we will replace the characters ‘Bi’ with ‘Automate’, so click on the Next step and select compose action. In input write the below expression.

replace(variables('Tech'),'Bi','Automate')
 Microsoft flow replace characters
Microsoft flow replace characters

Now click on Save and run the flow manually, and you can see the result in the compose output.

 Microsoft flow replace characters example
Microsoft flow replace characters example

This is an example of Microsoft flow replace characters.

Read Power Automate Desktop Flow – How to start

Power automate replace carriage return

Here we will see how to replace the carriage return in Power Automate.

I already have a flow, that is parsing the plain text email and creating an email in the SharePoint list. Now we will see after parsing the email of the user input data we get through email with a new line or carriage return.

Here we will see how to remove the carriage return or newline from the plain text.

Here my flow will trigger when a new email arrives(V3) like the below image.

Power automate replace carriage return
Power automate replace carriage return

Then we will parse the email using the Html to text action like below.

Microsoft Flow replace carriage return
Microsoft Flow replace carriage return

Now to replace the carriage return or newline to ‘|’, click on the Next step and select Compose action. In input write the below expression:

uriComponentToString(replace(uriComponent(body('Html_to_text')), '%0A', '|'))
How to replace carriage return in Microsoft Flow
How to replace carriage return in Microsoft Flow

Now click on Save and send an email to inbox to run the flow. You can see the result in the output of compose action.

Microsoft Flow replace carriage return example
Microsoft Flow replace carriage return example

This is an example of Microsoft Flow replace carriage return.

Read Power Automate SharePoint Get Items Filter Query + 12 Examples

Power automate replace comma

Here we will see how to replace the comma in Power Automate.

In Power Automate, select the Manually triggered flow, and then click on Next step.

Power automate replace comma
Power automate replace comma

Now we will initialize the sample string, so select Initialize variable action, and then set the variable name, type as a string, and in value sample string.

Power automate replace comma
Power automate replace comma example

Now we will split the string to put it collected and store it in an array variable. So, click on the Next step and select Initialize variable action and then provide the variable name, type as an array, and in value write the below expression:

split(string(variables('varData')), '"')
Power automate replace comma
Power automate replace comma

Then click on the Next step and we will initialize two string variables which we will use later in Apply to each action.

So, click on the next step and select initialize variable action, then provide the variable name and type as a string.

How to replace comma in Power Automate
How to replace comma in Power Automate

Next, we will apply to each split value, so click on the next step and select Apply to each action and then in value select the variable ‘datavalue’. from the dynamic content

Power automate replace comma example
Power automate replace comma example

And then inside apply to each action, click on Add an action, and select Set variable action, select the variable name as TextAfterSplit, and in value select current item from the dynamic content.

Microsoft Flow replace comma
Microsoft Flow replace comma

Next click on the Next step and select Set variable action and then in Name select ReplacedText.

replace(variables('TextAfterSplit'), ',', '')
Microsoft Flow replace comma
Microsoft Flow replace comma

Now click on Save and run the flow manually, you can see the output in the set variable action.

Microsoft Flow replace comma
Microsoft Flow replace comma

This is an example of Microsoft Flow replace a comma.

Read Power Automate send email to SharePoint group

Power automate replace comma with a carriage return

Here we will see how to replace the carriage return or new line with a comma using Microsoft flow.

In Power Automate, select the Manually triggered flow and then click on the Next step.

Microsoft Flow replace carriage returns with comma
Microsoft Flow replace carriage returns with comma

Select the compose action, in input write below sample value.

How to replace carriage returns with comma in Microsoft Flow
How to replace carriage returns with comma in Microsoft Flow

Now click on the next step, initialize variable, and then provide the variable name and type as a string and in value add the new line.

Microsoft Flow replace carriage returns with comma
Microsoft Flow replace carriage returns with comma

Then click on the Next step, and select the compose action, and in input write the below expression.

replace(outputs('Compose'),variables('varNewline'),',')
Power automate replace carriage returns with comma
Power automate replace carriage returns with comma

Now, click on Save and run the flow manually, you can see the result in the compose output.

How to replace carriage returns with comma in Power Automate
How to replace carriage returns with comma in Power Automate

This is an example Power automate replace carriage returns with a comma.

Read Power Automate remove characters from a string

Power automate replace double quote

Here we will see how to replace double quotes using Power Automate.

In Power Automate, select the Manually triggered Flow and then click on Next step.

Power automate replace double quote
Power automate replace double quote

Select initialize variable action and then provide the variable name, type as a string and provide the value like below.

Power automate replace double quote
Power automate replace double quote

Next click on the next step and select compose action, in input write the below expression

replace(variables('Tech'),'"','''')
Power automate replace double quote example
Power automate replace double quote example

Now click on save and run the flow manually, you can see the result in the compose output.

How to replace double quote in flow
How to replace double quote in flow

This is an example of Power automate replace double quote.

Read Power Automate Array Variable + 15 Examples

Power automate replace first character

Here we will see how to replace the first character from a string using Power Automate.

In Power Automate, select the Manually triggered Flow, then click on Next step.

Power automate replace first character
Power automate replace first character

Select Initialize variable action, then provide the variable name, type as string, and in value give a sample value like below.

Replace the first character from a string using Power Automate
Replace the first character from a string using Power Automate

Now we will replace the first character i.e. replace P with M, so click on the Next step and select Compose action. In input write the below expression.

replace(variables('Tech'),'P','M')
Power automate replace first character
Power automate replace first character

Now click on Save and run the flow manually, so you can see the result in the output of compose action

Power automate replace first character
How to replace first character in Microsoft flow

This is an example of Power automate replacing first character.

Check out, Power Automate send email based on form response

Power Automate replace last character from string

Here we will see how to replace the last character from string using Power Automate.

In Power Automate select the Manually triggered flow, and then click on Next step.

Power Automate replace last character from string
Power Automate replace last character from string

Select the Initialize variable action, and then provide the variable name, type as string, and in value provide a sample value.

How to replace last character from string in Power Automate
How to replace last character from string in Power Automate

Then click on the Next step and select compose action to replace the last character. In input write the below expression:

replace(variables('Tech'),last(variables('Tech')),'o')
Power Automate replace last character from string
Power Automate replace last character from string

Now click on save and run the flow manually, you can see the result in the compose output.

Power Automate replace last character from string example
Power Automate replace last character from string example

This is an example of Power Automate replacing the last character from the string.

Read Power automate split string into an array with examples

Power automate replace forward slash

Here we will see how to replace forward-slash using Power Automate.

In the Power Automate, select the Manually triggered flow, and then click on the Next step.

Power automate replace forward slash
Power automate replace forward slash

Select initialize variable action and then provide the variable name type as a string and in the value set the sample value.

Replace forward slash example in Power Automate
Replace forward slash example in Power Automate

Now we will replace the forward slash with ‘,’. In Powe Automate, select the compose action, and in input write the below expression.

replace(variables('Tech'),'/',',')
How to replace forward slash in Power automate
How to replace forward slash in Power automate

Now click on save and run the flow manually you can see the result in the compose output.

Replace forward slash Power automate
Replace forward slash Power automate

This is an example Power automate replace the forward slash.

Read Power Automate Rename File

Power automate replace newline

Here we will see how to replace newline with semicolons using Power Automate.

In Power Automate, select manually triggered flow, and then click on the Next step.

Power automate replace newline
Power automate replace newline

Next, select the compose action, in input write the below sample string value.

Replace newline in Power Automate
Replace newline in Power Automate

Now initialize a variable containing a new line, so click on the Next step and select Initialize variable action, and then provide the variable name, type as a string and in value add a new line.

Microsoft Flow replace newline
Microsoft Flow replace newline

Next, we will replace the newline with the semicolon, so click on the Next step and select compose action. In input write the below expression.

replace(outputs('Compose'),variables('varNewline'),';')
How to replace newline in Microsoft flow
How to replace newline in Microsoft flow

Now click on Save and run the flow manually, now you can see the result in the compose output.

Replace newline in Microsoft flow
Replace newline in Microsoft flow

This is an example of Microsoft Flow replacing the newline.

Read Power Automate String Functions + 10 Examples

Power automate replace multiple strings

Here we will see how to replace multiple strings using Power Automate.

In Power Automate, select the Manually triggered flow, then click on the Next step.

Replace multiple strings in Microsoft Flow
Microsoft Flow replace multiple strings

Next select Initialize variable action, and then provide the variable name, type as a string and provide the sample value.

Microsoft Flow replace multiple strings
Microsoft Flow replace multiple strings

Now we will replace the multiple string i.e. Power with SharePoint and automate with online. So, click on the Next step and select Compose action, in Input write the below expression:

replace(replace(variables('varString'),'Power','SharePoint'),'Automate','Online')
Power automate replace multiple strings
Power automate replace multiple strings

Now click on save and run the flow manually, you can see the result in the compose output.

Replace multiple strings in Power Automate
Power automate replace multiple strings

This is an example of Power automate replace multiple strings.

Check out, Power Automate send email from shared mailbox

Power automate replace with nothing

Here we will see how to replace with nothing using Power Automate.

In Power Automate select the Manually triggered flow, then click on Next step.

Power automate replace with nothing
Power automate replace with nothing

Select initialize variable action, and then provide the variable name, type as string, and in value write the below string.

How to replace with nothing in Power Automate
How to replace with nothing in Power Automate

Now we will replace the string ’12-12-2021′ with nothing is ’12 12 2021′. So click on the Next step and select the compose action. In input write the below expression:

replace(variables('varString'),'-',' ')
replace with nothing in Power Automate
Example of Power automate replace with nothing

Now click on Save and run the flow, you can see the result in the compose output.

Power automate replace with nothing
Power automate replace with nothing

This is an example of Power automate replace with nothing.

Related Power Automate tutorials:

In this Power Automate tutorial, we learned about the Power automate replace function. And also we discuss the below example:

  • Power automate replace
  • Power automate replace apostrophe in string
  • Power automate replace ampersand
  • Power automate replace string in variable
  • Power automate replace special characters
  • Power automate replace all special characters
  • power automate replace with empty string
  • power automate replace array element
  • power automate replace single quote
  • power automate replace multiple characters
  • power automate replace value in array
  • power automate replace characters
  • power automate replace carriage return
  • power automate replace comma
  • power automate replace comma with carriage return
  • power automate replace double quote
  • power automate replace first character
  • power automate replace last character from string
  • power automate replace forward slash
  • power automate replace newline
  • power automate replace multiple strings
  • power automate replace with nothing
>