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!


View solution in original post

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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

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.

Users online (1,949)