Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Extracting Strings from Email Body

Sorry if this has already been posted...

This is my conundrum.

We get emails to managers with the particulars of an event (PTO/Vacation/Sick) and I am looking for a way to extract the information in Flow.


This is the body of the Email message in flow.  I can isolate parts of it, but unsure about others.


Time Off Request(s) Approved by sysadmin  <-- This is the key that I have if an email comes in with this in the Body

Employee: John Smith  <-- I need a script that will isolate name, given that name will be various lengths.
Hours: 8.00
Time-Off Type: Paid Time Off
09-24-2018 at 08:00:00


Everything else I can Pretty much do but its the Employee name that is holding me up.  

I can find 'Employee: ' in the message body but I can not find a way to account for something that goes until end of line.  I can not isolate the name through the AAD as its going to the manager, not to the employee themselves.


I know someone has done this before as I cant be the only one.  

Many thanks in advance.




Community Support
Community Support

Hi @MyNameIsAjax,


Could you share a screenshot of your current Flow configuration?

What you mean is that you want to get the name of the Employee in the body of the email, here is the String after "Employee:".

Have you tried using Html to text to convert the body of a message into text?

Could you provide the format of your email body?

I wonder if the format is similar to the following, maybe you could refer to the link below, use the function provided by Expression to extract the string you want from email body text.



Please take a try.


Best Regards,


Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This is what I have done so far and made some good progress on it.

1.  Convert to Text based on the condition flow

2. Get the EmployeeName start Index


3. Get the EmployeeName end index based upon the next line in the email which should be 'hours:'.  When it finds that string that is the end of the employee name


4.  Now I get the employeename based upon the start and end indexes above

5.  I am repeating this process for Hours and the number of hours the person has but it brings up an issue.  The issue being that the hours are presented in this format 8.00 but if its 16.00 then there is an extra character there.  Not sure if there is a way to look for a character inside when I am isolating the hours and if its 4 in length or 5 in length but all numeric and then eliminate non-numerics.  Or grab the first 2 characters and if the second is a '.' then just use the first character.
6.  The next issue that I am going to run into (not there yet), is the date(s) line.  If their time off spans more than one day then multiple dates are presented on the email on different lines.  I need to loop through the lines (somehow determining if there is but a single date or multiple dates on multiple lines).  This could get messy.
tl;dr - 5 and 6 
here is a screenshot of my flow so far.


Helpful resources

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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,915)