Showing results for 
Search instead for 
Did you mean: 
New Member

Find and split text (email body) at newline before hard limit

I am hoping for a little guidance here as I am at a loss as to how to achieve this in Flow/Power Automate rather than in straight code.


I have an email coming in that may be small at lets say 10,000 characters or large at lets say 350,000 characters (its an automated change email) which then needs to be processed into a system (Slack) that has a 100,000 character hard limit input (but I can simply drop 4 lots of text straight one after the other in this example and it will get processed correctly).


Checking to see if the email message is under the 100,000 character limit and processing if not is straight forward, however to process those over the 100,000 character limit I need to split the text and run it using a loop which is fine but I need to split the text at the new line character that is some characters prior to the 100,000 limit. Remember that position, paste the extracted portion of the text into slack, using that position again to the check (if remainder of the text is still longer than the 100,000 charater limit and if is), split, post sequence until there is no text left


Thoughts? Obviously a loop is going to be involved and a couple of variables its more the finding and splitting of the text at the correct place that has me stumped



Hi there.  So, here's an idea:


  • When you use the Split() function on a string, it converts that string to an array with multiple segments (or elements). 
  • You could then use an "Apply to Each" loop to work through each element of that array.
  • If this works with the smaller ones (<100k), then you can lose the condition and just treat all blocks the same (Adding to Slack at each new line character).

Hopefully, that helps.

Keep us posted.



If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Thanks @edgonzales I did not think of that, much simpler, I will give that a shot



Helpful resources

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.

Users online (2,108)