Shane Bartholomeusz

Geek and lover of all things tech related

Power Automate: Remove End of Line Characters

Problem

Parsing text can be somewhat tricky with Microsoft Power Automate or Azure Logic Apps. Recently I needed to strip out end-of-line characters (CR/LF) from a text string.

This task actually proved to be a bit more challenging than I had expected… However in this post I’ll share the solution that I found and ultimately ended up using.

Power Automate Logo

Solution

The following expression will remove the end-of-line characters from text strings in your Power Automate or Azure Logic Apps workflow.

uriComponentToString(replace(uriComponent(<YOUR_TEXT_HERE>), '%0A', ''))

Example

To demonstrate this, we have a Power Automate workflow that does the following:

  1. Extracts the plain text from a text string containing HTML content.
  2. Writes the output to a text file.
  3. Writes the output to another text file, however in this file, the end-of-line characters are removed by using the above expression.
Power Automate Screenshot
Power Automate Screenshot
Power Automate Screenshot
Power Automate Screenshot
Power Automate Screenshot

Final Thoughts

I hope this solution has helped you. If you find an alternative solution, feel free to post it below to help others out there.

Happy Power-Automating!

Shane Bartholomeusz

1 Comment

  1. Hey Shane!

    Look mate! I’m seriously grateful to you for this blog post.
    I have been banging my head against the wall in the past ~3 hours.
    You’ve saved my ass for real.
    Thanks a lot, mate!

    You are the man!

    Keep rollin’!

    Krisztian

Leave a Reply

© 2024 Shane Bartholomeusz

Theme by Anders NorenUp ↑