cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chrisingham Helper I
Helper I

Issue finding text in email body

Hello,

 

I'm trying to use Flow to extrac some information from an email body but I'm encountering a very unusual problem when trying to extract part of a title between two placeholders;

 

1) I convert the body of the email to text using the HTML to Text conversion

2) I look for the first placeholder text before the text I want to extract using;

        a) add(indexof(body('Html_to_text'),'Short Description = '),20) - The 20 gives me the end character of the string rather than                  start
3) I look for the placeholder text at the end of the text I want to extract using;
       b) indexOf(body('Html_to_text'),'Customer')
4) I then look for the text between the two placeholders using;
      c) substring(body('Html_to_text'),variables('TitleStart'),variables('TitleEnd'))
 
The issue is, the start character formula returns 232 which correctly gives me the start of the title I want to search for, the end character formula returns 271 which gives a 39 character long string in the middle which is correct, however the output of the last function which should give a string between characters 232 and 271 (39 chars) actually gives a string that is 262 characters long. I can't understand why this is, as the function simply asks for a substring of the email body from chars 232 to 271. The start position of the text string is correct, but the string goes on too long and doesn't stop. 
 
Has anyone encountered this problem before? Does anyone know how to resolve this? I've manipulated text many times in flow and never encountered this problem before
 
Thanks
Chris
 
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
chrisingham Helper I
Helper I

Re: Issue finding text in email body

Sorry! I just realised the problem, the substring function asks for a length at the end, not the end character number. I can't figure out how to delete this question now!

 

View solution in original post

2 REPLIES 2
chrisingham Helper I
Helper I

Re: Issue finding text in email body

Sorry! I just realised the problem, the substring function asks for a length at the end, not the end character number. I can't figure out how to delete this question now!

 

View solution in original post

Super User
Super User

Re: Issue finding text in email body

@chrisingham  Just mark it  completed 🙂 

 

-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (5,898)