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

Super User II
Super User II


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

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

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (18,617)