web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Removing a "\r" charac...
Power Automate
Suggested Answer

Removing a "\r" character from a string

(0) ShareShare
ReportReport
Posted on by 11
Howdy all,
 
Currently my flow has a string that has a "\r" character in it and I cannot figure out how to remove. There's two compose actions where I could remove it, 
 
In the first one the string is produced by: first(input array) and the string output looks like this: 
"84739,99294,35243.04,49535,0.393,1.481\r"
 
In the second one that string is converted to an array via the split() function and combined with another array into a single long string that looks like:
"84739,99294,35243.04,49535,0.393,1.481\rTE545063,Company,Employee,650,...." The string continues bit the \r is show there.
 
That 1.481 number will change as it's a varied test result so I can't reference that directly.
 
It can be changed in either compose statement, I just need the \r to not be there.
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,169 Most Valuable Professional on at
    /r is what you get for an escaped carriage return.  Try doing a replace() with Char(13) as the target and replace it with a space.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Garima_PowerPlatform Profile Picture
    170 on at
    Hi

    Step 1: Removing from a string

    • Compose Action:
      replace(first(outputs('Your_Input_Array')), '\r', '')
    Step 2: After Splitting and Combining
    • Compose Action:
      replace(outputs('SplitArrayCombined'), '\r', '')
    Replace outputs('Your_Input_Array') and outputs('SplitArrayCombined') with the appropriate flow outputs.

    Notes:

    • The replace() function in Power Automate replaces all instances of the specified substring.
    • Ensure the context matches where the string with the \r appears and apply the replacement.
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
     
  • Suggested answer
    Garima_PowerPlatform Profile Picture
    170 on at
    Hi

    Step 1: Removing from a string

    • Compose Action:
      replace(first(outputs('Your_Input_Array')), '\r', '')
    Step 2: After Splitting and Combining
    • Compose Action:
      replace(outputs('SplitArrayCombined'), '\r', '')
    Replace outputs('Your_Input_Array') and outputs('SplitArrayCombined') with the appropriate flow outputs.

    Notes:

    • The replace() function in Power Automate replaces all instances of the specified substring.
    • Ensure the context matches where the string with the \r appears and apply the replacement.
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
     
  • BS-16011335-0 Profile Picture
    2 on at
    I was able to get it to work using this replace:
     
    replace(outputs('Prior_Step_Name'),decodeUriComponent('%0D') ,'')

    For my specific example, I was trying to remove blank lines that looked like '\r\n\r\n' (want to replace double line feeds with a single), and for that I used this:

    replace(outputs('Prior_Step_Name'),decodeUriComponent(
    '%0D%0A%0D%0A') ,decodeUriComponent('%0D%0A'))

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 639

#2
Valantis Profile Picture

Valantis 392

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard