cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Memorable Member
Memorable Member

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
Super User

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
Super User

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!



_Ken
Advocate I
Advocate I

\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 Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

AI Builder AMA June 7th carousel (up on May 25th, take down June 8th) (1).png

'Ask Microsoft Anything' about AI Builder!

The AI Builder team invite you to ask questions and provide helpful answers at our next AMA.

Users online (1,508)