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.
Select initialize variable action, and then provide the variable name, type as string, and value like below.
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'), '''', '"')
Now, click on Save and run the flow manually, then you can see the result in the output of compose action.
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.
Select the Initialize variable action and then provide the variable name, type as a string, and set the value like the below screenshot.
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'), '&', ' ')
Now click on Save and run the flow manually, you can see the result in the output section.
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.
Select the initialize variable action, then provide the variable name, type as a string, and set value like below.
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')
Now click on Save and run the flow manually, you can see the result in the output of the compose action.
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.
Select the Initialize variable action, and then provide the variable name, type as a string, and set the value.
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'),'/','''')
Now click on save and run the flow manually, so you can see the output in the compose action.
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.
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('.','@','ß','²','³','µ','`','´','°','^','=','(',')','&','$','§', '~','#','%','*',':','<','>','?','/','|',' ', ' ','{','}','!','+','__','___')
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:
Here we will initialize two variables to hold the values later in apply to each action.
Next, click on the next step and select Apply to each action in the output set the variable ‘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(),'_')
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(),'_')
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.
To see the result we will use the compose action, so click on Next step and in input select the variable ‘stringwithspecialcharacter’.
Now click on Save and run the flow manually, now you can see the result in the compose action.
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.
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.
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')
Now click on save and run the flow manually, you can see the result in the output of the compose action.
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.
Select initialize variable action, and then provide the variable name, type as an array, and set the value with the sample array.
Click on the Next step, select Initialize variable action with type as Integer and array.
Now, click on the Next step, and select Apply to each action, and in the output set the ArrayOfId.
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.
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.
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 [].
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.
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']
Next, to see the result, click on the Next step and select Compose action, and in Input select ArrayOfId variable.
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.
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.
Select Initialize variable action, and then provide the variable name, type as string, and assign a sample value.
Then click on the Next step, and select the Compose action. Then in input write the below expression.
replace(variables('Tech'),'''','"')
Now click on Save and run the flow manually, you can see the result in the compose output.
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.
Select Initialize variable action, and then provide the variable name, type as a string, and then assign a sample value.
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')
Now click on Save and run the flow manually and you can see the result in the compose output.
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.
Select the Initialize variable action, and then set variable name, type as a string and in value assign a value.
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')
Now click on Save and run the flow manually, and you can see the result in the compose output.
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.
Then we will parse the email using the Html to text action like below.
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', '|'))
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.
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.
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.
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')), '"')
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.
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
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.
Next click on the Next step and select Set variable action and then in Name select ReplacedText.
replace(variables('TextAfterSplit'), ',', '')
Now click on Save and run the flow manually, you can see the output in the set variable action.
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.
Select the compose action, in input write below sample value.
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.
Then click on the Next step, and select the compose action, and in input write the below expression.
replace(outputs('Compose'),variables('varNewline'),',')
Now, click on Save and run the flow manually, you can see the result in the compose output.
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.
Select initialize variable action and then provide the variable name, type as a string and provide the value like below.
Next click on the next step and select compose action, in input write the below expression
replace(variables('Tech'),'"','''')
Now click on save and run the flow manually, you can see the result in the compose output.
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.
Select Initialize variable action, then provide the variable name, type as string, and in value give a sample value like below.
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')
Now click on Save and run the flow manually, so you can see the result in the output of compose action
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.
Select the Initialize variable action, and then provide the variable name, type as string, and in value provide a sample value.
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')
Now click on save and run the flow manually, you can see the result in the compose output.
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.
Select initialize variable action and then provide the variable name type as a string and in the value set the sample value.
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'),'/',',')
Now click on save and run the flow manually you can see the result in the compose output.
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.
Next, select the compose action, in input write the below sample string value.
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.
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'),';')
Now click on Save and run the flow manually, now you can see the result in the compose output.
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.
Next select Initialize variable action, and then provide the variable name, type as a string and provide the sample value.
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')
Now click on save and run the flow manually, you can see the result in the compose output.
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.
Select initialize variable action, and then provide the variable name, type as string, and in value write the below string.
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'),'-',' ')
Now click on Save and run the flow, you can see the result in the compose output.
This is an example of Power automate replace with nothing.
Related Power Automate tutorials:
- Power Automate Parse Email Body
- Power Automate Date Functions – 9 Examples
- Power Automate Get Data from Excel on SharePoint
- Power Automate Forms to Excel
- Power Automate create an HTML table
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
Bhawana Rathore is a Microsoft MVP (3 times in Office Apps & Services) and a passionate SharePoint Consultant, having around 10 years of IT experience in the industry, as well as in .Net technologies. She likes to share her technical expertise in EnjoySharePoint.com and SPGuides.com
Hi, great article. Can you give us an example on how to uppercase or lowercase very first character from each word in a string? For example: this is a sentence => This Is A Sentence
Kind regards
Adrian