cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cplumblarrick
New Member

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
AlanPs1
Resident Rockstar
Resident Rockstar

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

7 REPLIES 7
AlanPs1
Resident Rockstar
Resident Rockstar

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!


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.

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
Frequent Visitor

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'))

 

Flow accepts this as a valid expression, however in my case it splits the input line in a random space!

Thank you for your solution.

Work fine !

LinnZawWin
Kudo Kingpin
Kudo Kingpin

Thanks @AlanPs1 

decodeUriComponent('%0A')

saved my life.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

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.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,534)