Power Automate Remove Characters From String [With Helpful Examples]

Recently, When I was working with Power Automate, I got a task to remove characters from a text string using Power Automate. This tutorial will explain how to remove characters from a string using Power Automate string() functions.

Also, I will cover the below topics:

  • Power Automate: remove the first character from a string
  • How to remove the last character from a string using Power Automate
  • Eliminating the first and last characters from a string in Power Automate
  • Removing multiple characters from a string using Power Automate
  • How to eliminate specific characters from a string in Power Automate
  • How to remove the last ‘n’ number of characters from a string in Power Automate

Remove First Character from a String in Power Automate

Now, let me show you how to eliminate a single character from a text string using Power Automate.

Example

InputOutput
United States of Americanited States of America

To work around this, follow the below step-by-step:

1. Navigate to https://make.powerautomate.com to open your Power Automate home page -> Click on + Create -> Select an Instant Cloud Flow and assign a name to it -> Choose the trigger’s flow “Manually trigger the flow” and click on the Create button.

  • Add a text input inside the trigger.
How to remove first character from a string in Power Automate

2. After that, take an Initialize variable flow action to initialize the text variable. Set the following details:

  • Name: Provide the name of the variable.
  • Type: Select the type of the variable as String
  • Value: Here, I have given value from the dynamic content ‘Text‘.
Removing first character from a String using Power Automate

3. Add the ‘Compose’ flow action to set the expression to skip the elements.

  • Inputs: Select field -> Select Expression -> Insert the expression -> Click on OK.
skip(variables('Text'),1)
Remove first character from a String using Power Automate

4. Now, it’s time to Save and Test -> Click on Save -> Test it Manually -> Then expand the compose flow action to display the output below.

Output:

The output will display the string by removing the first character.

Power Automate Remove Characters From String

This is how to remove the first character from a string using Power Automate.

You may also like: Remove Special Characters from a String in Power Automate.

Power Automate remove specific characters from a string

Let us see how to remove specific characters from a string using Power Automate flow.

In this example, I will show you how to remove characters from a string using flow

Example:

InputOutput
[“Power Apps”]Power Apps

1. Create an instant clod flow with a manual trigger and add a text input.

2. Add a compose data operation and pass the below expression, which helps to replace the [ ” “] extra characters.

replace(replace(replace(replace(triggerBody()['text'],'[',' '),']',' '),'''',' '),'"',' ')
How to remove characters from string in Power Automate

3. Save and run the flow, take the input value, and click the Run flow option.

How to remove characters from string in Power Automate flow

4. Once the flow runs successfully like below, we can see that it removes the unwanted characters from the given value as shown below:

Remove characters from string in Power Automate flow

This is how to remove specific characters from a string using Power Automate flow.

Power Automate Remove Multiple Characters from the String

Now, I will discuss how to remove multiple characters from the string in Power Automate.

Follow the below steps:

1. Create an instant cloud flow and add a text input.

2. Take a Compose flow action and pass the below characters you want to remove from the input string.

"!","@","[","]","&"
Power Automate remove multiple characters from the string

3. Next to that, add select data operation from action triggers in the form section and pass the below expression:

range(0, length(triggerBody()['text']))

In the Map section, pass the below expression, which removes the character and returns the string value.

if(contains(outputs('Compose'),substring(triggerBody()['text'],item(),1)), '',substring(triggerBody()['text'],item(), 1))
How to remove multiple characters from the string in Power Automate

5. Add another data operation and use the below expression to join the expression.

join(body('Select'),'')
Eliminate multiple characters from the string using Power Automate

6. Save and Run the flow. I have taken the Input value as shown in the screenshot below.

Click the Runflow button.

remove multiple characters from the string in power automate flow

7. Once the flow runs successfully, we can see that it removes the characters and returns the string value.

Power Automate remove multiple characters from a string

This is how to remove multiple characters from the string using Power Automate functions.

How to Remove the Last Characters from a String in Power Automate

Let us see how to remove last character from string in Power Automate.

Follow the below steps:

1. Create a Power Automate Instant cloud flow with the text input.

2. Take the Compose flow action and pass the below expression in the Inputs section.

substring(triggerBody()['text'], 0, sub(length(triggerBody()['text']), 2))
Remove last character of a string in Power Automate

3. Then, Save and Run the flow. I have provided the input value as given below:

How to Remove the Last Characters from a String in Power Automate

4. Once the flow runs successfully, you can see that it removes the last characters from a given string.

Remove characters from the end of a string in the Power Automate

This way, you can remove last character from string in Power Automate.

Power Automate Remove Last ‘N’ Number of Characters from String

Now, I will show you how to remove the last ‘n’ number of characters from a given string value using Power Automate.

Example:

String RemoveOutput
New member alert! Welcome to our communityLast 10 CharactersRemove the last 10 characters

Follow the below given steps:

1. Add a Compose flow action to give the expression.

Inputs: Add the code that is given below.

substring(variables('Text'),0,sub(length(variables('Text')),10))
How to remove last N characters of a string in Power Automate

In the above expression, Replace the number of characters you wanted to remove.

2. After that, save and test the flow. In the Runflow window, I’m taking the below text value.

Then, click Runflow.

Removing last 'N' characters from a string in Power Automate

Output:

Power Automate remove last n characters from a string

This is how to remove the last ‘n’ number of characters from a given string with Power Automate.

Power Automate remove first and last character from string

Now, I will show how to remove the first and last character from a string using Power Automate.

Check out the steps:

1. Create an instant cloud flow with a manual trigger and add a text input.

2. Add a compose data operation and pass the below expression:

substring(triggerBody()['text'],1, sub(length(triggerBody()['text']),2))
Removes the first and last characters from a string using flow

After that, save and test the flow manually.

3. In the Runflow window, take the Input value. Click the Run flow option.

Removing first and last character from a string in Power Automate

4. When the flow runs successfully, it will display the output of a string, eliminating the first and last characters.

Refer to the image below:

How to eliminate first and last characters from a string using Power Automate

Here’s how to remove the first and last characters from a string using Power Automate.

Conclusion

I hope this Power Automate tutorial is helpful and guides you through remove character from a strin in Power Automate and the below related examples.

  • Remove characters from string in Power Automate
  • Remove the last character from a string in Power Automate
  • Delete the last character from a string in Power Automate
  • Remove everything after a character in Power Automate
  • Remove the first character from a string in Power Automate
  • Remove the first and last character from a string in Power Automate

You may also like:

  • This is a great article, but cannot seem to get my scenario to work with any of these example. Some items may have several special characters that need removed such as &, /, and ‘ that I need to do in one business name. The apply to each seem to only remove one special character at a time and when I do the last compose statement, it takes just the latest apply to each scenario and uses it. For example, my current array is just two items until I can figure out how to check for all of them at once, createArray(‘&’,””). What am I missing to check for all at one time and replace?

    • turn your array into a string then build up your replaces around it, no need to actually do an Apply to each. In a compose example replace(replace(replace(string(createArray(‘&’,'”‘))’thingtoreaplce’,’replacewith’),’thingtoreplace’,’replacewith’),’thingtoredplace’,’replacewith’) that example does 3 replaces on the string created from your array value. once that is done, then take the output from the compose you created. no need to look, its just a bigger function of built up replaces

  • I want to say thanks, this is a super amazing useful well done page. Lots of yours are but I use this one a lot thank you so much!

  • Hello,

    Thanks for creating this. The “Power Automate remove multiple characters from string” section is exactly what i am looking for. Do you know how i can change this flow to perform this process on multiple file names at once?. Ex I have users uploading documents to a SharePoint list item, from there I’ll us power automate to move the documents from the list to a document library. Many of the file names will have a # in them which will cause the flow to fail. I have tried to set the flow up to apply to multiple files at once but have yet to succeed yet.

    Thanks

  • >

    Build a High-Performance Project Management Site in SharePoint Online

    User registration Power Apps canvas app

    DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

    Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

    Power Platform Tutorial FREE PDF Download

    FREE Power Platform Tutorial PDF

    Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…