cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cplumblarrick
Level: Power Up

Need to find new line characters in a body of text

But it doesn't seem like you can do this... For example if I try to include "\r\n" within an expression (such as in indexOf), the actual JSON produced will have double escapes (i.e. the assumption is built in that I'm trying to literally look for those backslashes, no matter what) -- This doesn't work and isn't what I want.

 

e.g. instead of this "@indexOf(string(outputs('Compose_2')),'\r\n')" it will create this "@indexOf(string(outputs('Compose_2')),'\\r\\n')"

 

There doesn't seem to be any way to directly edit this text either... so it seems like I am stuck. Has anyone figured out a workaround? 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Need to find new line characters in a body of text

Hi @cplumblarrick , thank you for your post in the community Smiley Happy

Here is how I handle new line, please see below:Capture-487.png

decodeUriComponent('%0A')
this
is a
few lines of
text with spaces and
carriage returns
split(outputs('Compose_Text'), outputs('Compose_NewLine'))
outputs('Compose_Find_NewLines')[2]

 

If you implement the steps above, you can get an output like the belowCapture-488.png

I am hoping this demo puts you on the right track.

 

If you have found my post helpful, please mark thumbs up.

 

Any other questions, just ask.

 

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


View solution in original post

4 REPLIES 4
Super User
Super User

Re: Need to find new line characters in a body of text

Hi @cplumblarrick , thank you for your post in the community Smiley Happy

Here is how I handle new line, please see below:Capture-487.png

decodeUriComponent('%0A')
this
is a
few lines of
text with spaces and
carriage returns
split(outputs('Compose_Text'), outputs('Compose_NewLine'))
outputs('Compose_Find_NewLines')[2]

 

If you implement the steps above, you can get an output like the belowCapture-488.png

I am hoping this demo puts you on the right track.

 

If you have found my post helpful, please mark thumbs up.

 

Any other questions, just ask.

 

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


View solution in original post

cplumblarrick
Level: Power Up

Re: Need to find new line characters in a body of text

Thank you @AlanPs1 — that was exactly the workaround I needed. This should let me work with all the characters I’m likely to need, too.
Super User
Super User

Re: Need to find new line characters in a body of text

No problem @cplumblarrick 

The pleasure was all mine.

 

Be sure to post a new thread any time you have any other questions.

 

If you have found my post helpful, please mark thumbs up.

 

Any other questions, just ask.

Happy Flowing!

Thanks, Alan


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


belallari
Level: Powered On

Re: Need to find new line characters in a body of text

Use decodeUriComponent('%0A') function to get new line code. 

 

Example below used to break email message into lines

 

split(outputs('Html_to_text')?['body'],'\n'))  (this does not work)

use

split(outputs('Html_to_text')?['body'],decodeUriComponent('%0A'))

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 384 members 5,505 guests
Please welcome our newest community members: