cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Power Participant
Power Participant

Split at \r\n\r\n

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 

1 ACCEPTED SOLUTION

Accepted Solutions
efialttes
Super User III
Super User III

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

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

2 REPLIES 2
efialttes
Super User III
Super User III

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

 

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



View solution in original post

_Ken
Frequent Visitor

\r can be addressed as decodeUriComponent('%0D)
\n as decodeUriComponent('%0A')
One simple solution with multiple \r\n\r\n would be as follows:

split(body('Parse_JSON')?['bodyPreview'], decodeUriComponent('%0D%0A%0D%0A'))

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Top Solution Authors
Users online (2,892)