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 / Remove line breaks in ...
Power Automate
Answered

Remove line breaks in String only when they are between speech marks

(1) ShareShare
ReportReport
Posted on by 122
Hi all

I have a csv which is being exported as an email attachment, I am then using Power Automate to get the attachment content to Base64 then convert it to a String.  I am using this data to add a row to a table in excel by splitting on line breaks in order to create an array by using the function
split(outputs('Remove_line_breaks_within_content'),decodeUriComponent('%0D%0A'))
The problem I am having is that some of the data might have line breaks in them.  I need a way to remove/replace line breaks if they are within a set of speech marks.  I have tried using regex but haven't got anywhere.
replace(outputs('Base64_To_String'),'(\".*?)\r\n(.*?\")', '$1$3')
 
Data example:
"Infocard","Number","Title","Vault"
"CPR","12","Example Data
","TAG"
"CRQ","12","Example Data without line break","TAG"
 
Is there another way I can do this which will ensure that line breaks that occur within the Title field are removed but they remain at the end of each row?
 
Thanks
Grant
Categories:
I have the same question (0)
  • Verified answer
    abm abm Profile Picture
    32,985 Most Valuable Professional on at
    Try the  below
     
     
     
    Expressions are:
     
    replace(outputs('Compose'), decodeUriComponent('%0A'), ' ')
     
    This will remove all the new lines
     
    split(outputs('Compose_2'),'" "')
     
    The above split is used for splitting each line using '" "'
     
    Here is my test result
     
     
     

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 784

#2
Valantis Profile Picture

Valantis 589

#3
Haque Profile Picture

Haque 522

Last 30 days Overall leaderboard