Skip to main content
Community site session details

Community site session details

Session Id : aEa4C7wL6oQxpNsa2pRBgg
Power Automate - Building Flows
Answered

Split is not recognizing /n

Like (0) ShareShare
ReportReport
Posted on 17 Jun 2024 16:36:42 by 22

Why is my split not recognizing the new line character?

Here is the Expression: 
JimLee_0-1718641863250.png

Here are the inputs and outputs: 

JimLee_1-1718641902842.png

Clearly \n is in the text, but split is not splitting it into an array. Split works if I choose another character like * (there are bullets in the text). The text is from a variable that is being set using a HTML to Text action. 

Any ideas? 

  • JimLee Profile Picture
    22 on 20 Jun 2024 at 21:38:25
    Re: Split is not recognizing /n

    @v-bofeng-msft  - That did it! Thanks! 

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 2 on 18 Jun 2024 at 09:58:56
    Re: Split is not recognizing /n

    In Power Automate strings, the backslash is not an escape character (as in JSON and many programming languages), so decodeUriComponent() is the way to go.

    An encoding reference can be found here.

     

    Or convert the value to JSON before replaceing (no, don't do that) 😉

    Chriddle_0-1718703811691.png

     

    replace(
    	slice(
    		string(createArray(outputs('Compose'))),
    		1,-1
    	),
    	'\n',
    	' | '
    )

     

    Chriddle_1-1718703890359.png

     

     

  • Verified answer
    v-bofeng-msft Profile Picture
    on 18 Jun 2024 at 07:46:57
    Re: Split is not recognizing /n

    Hi @JimLee ,

     

    Please try:

    split(variable('EmailBody'),decodeUriComponent('%0A'))

     

    Best Regards,

    Bof

  • creativeopinion Profile Picture
    10,464 Super User 2025 Season 2 on 17 Jun 2024 at 16:47:03
    Re: Split is not recognizing /n

    @JimLee Use a Compose action to store a line break. 

    creativeopinion_0-1718642775481.png

     

    Insert the output from the Compose action with the line break into your expression. I cover how to do that in the split() section of my YT Tutorial: 7 Functions You Need to Know | ️Expression Essentials: Part 1

     

    In this section, I'll cover how to get dynamic content with an expression when the dynamic content you need isn't listed in the dynamic content menu.

     

    In the full tutorial I cover 7 functions you need to know when getting started with expressions.

    1️⃣ empty()

    2️⃣ coalesce()

    3️⃣ equals()

    4️⃣ if()

    5️⃣ concat()

    6️⃣ length()

    7️⃣ split()

     

    I cover how to use these functions in expressions and I’ll also cover common mistakes when it comes to writing expressions and show you a few tips and tricks along the way.

     

    As a beginner or even an intermediate flow builder—expressions can seem a bit complex at first, I’m going to try to simplify it for you. If you want to level up your flows by writing expressions—keep watching!

     

    IN THIS VIDEO:

     What is an Expression?

     What is a Function?

     What Does Wrapping a Function Mean?

     How Do I Insert an Expression?

     How to Use a Compose action

     How to Navigate the Expression Builder with Arrow Keys

     How to use the Expression Tooltip

     Common Mistakes When Writing Expressions

     How to differentiate a null from an empty string

     How to Get Dynamic Content When it’s Not Listed

     How to Use a Get Item Action to Verify Dynamic Content Output

     How to Convert Strings to Lower Case

     How to Troubleshoot the if() Function

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2