Notifications
Announcements
Hi
Im trying to split an email body preview at \r\n\r\n but the split does not seem to work.
split(body('Parse_JSON')?['bodyPreview'], '\r\n\r\n')
I just end up with one line, nothing is split
Hi!
Guess this same problem happens when dealing with CSV files.
If so, some threads in this same community discussing this other topic, like
https://powerusers.microsoft.com/t5/Building-Flows/Split-method-parse-csv/td-p/514345
Use uriComponent() function to convert the string into URI code, then use replace() function to replace line separator("%0D%0A") and add ";" instead, then use decodeUriComponent() to decode it ... Then use the split() function to create an array: split(outputs('Compose'),';')
Hope this helps
\r can be addressed as decodeUriComponent('%0D')\n as decodeUriComponent('%0A')One simple solution with multiple \r\n\r\n as follows:
split(body('Parse_JSON')?['bodyPreview'], decodeUriComponent('%0D%0A%0D%0A'))
Thanks for that; worked for me - and only thing that did, after trying other suggestions
Hi Ken,
I sent my email body to a variable and wrote the following expression in a compose action.
Quick test of the ADO 'Create a Work Item' action seems to indicate it differs from field to field.
Description - seem to prefer a html <br>
Repro Steps - seem to truncate any line breaks
Best way to find out is looking at the Power Automate run results input/output and experiment with different line break types.
This is what worked.
Awesome - nice solution.
Will add that to my list of script snippets.
Thank you so much efialttes!
I Spent an hour arguing with Microsoft Copilot about this then noticed in the code view in Power Automate that when I was splitting by '\r\n' the code was '\\r\\n'
However your approach worked first time
trim(split(split(triggerOutputs()?['body/body'], 'Depot: ')[1], decodeUriComponent('%0D%0A'))[0])
reading the body of my email and splitting the string up based on the text after 'Depot: ' and before the \r\n
Thanks again, this one has been bugging me for a few hours
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.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 503 Super User 2025 Season 2
Tomac 321 Moderator
abm abm 237 Most Valuable Professional