Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

How to extract only part of a line from an email (after the word email:)

Like (1) ShareShare
ReportReport
Posted on 25 Sep 2024 16:22:33 by 44
I am attempting to extract an email address from the body of the email. I have successfully extracted the entire line that includes the email address; however, it is extracting the word "email:" as well. How do I set the expression so that only the email address (text after email:) is extracted in stead. Any insight and help is appreciated. Thank you

Picture A is the email that we receive 
Picture B is first Compose 
Picture C is the Second Compose
Picture D is the success output of the compose but includes "email" in the output which is what I am wanting to have not included. 

A:

B:
 
C:
D:
 
 
  • Suggested answer
    BizAppBee Profile Picture
    BizAppBee 81 on 04 Oct 2024 at 21:50:15
    How to extract only part of a line from an email (after the word email:)
    Hi @ASmithRouse,  in your case, you would replace 'triggerBody()['text']' with I believe body('Html_to_text') - how you did your first compose. Sorry I should have been more clear:
     
     
    Replace(First(Split(Last(Split(body('Html_to_text'),'Email:')), 'Inquiry')),' ','')
  • AlexEncodian Profile Picture
    AlexEncodian 4,265 on 01 Oct 2024 at 06:55:29
    How to extract only part of a line from an email (after the word email:)
    I'm not as skilled with expressions as others here so I will defer to the experts.
     
    Encodian provides a few no code options:
     
    1) Utility - Extract Email Addresses from Text (simply pass HTML to text result and it will extract email addresses)
    2) Utility - Extract Text between Values (extract text between "Email:" and "typed line break") 
  • ASmithRouse Profile Picture
    ASmithRouse 44 on 27 Sep 2024 at 13:45:41
    How to extract only part of a line from an email (after the word email:)
    @BizAppBee 

    This is not work unfortunately. This is the error I got. 

  • Suggested answer
    BizAppBee Profile Picture
    BizAppBee 81 on 27 Sep 2024 at 03:29:31
    How to extract only part of a line from an email (after the word email:)
     
    Please try the following expression:
     
    Replace(First(Split(Last(Split(triggerBody()['text'], 'Email:')), 'Inquiry')),' ','')
     
     I did a test on my end where for the purpose of this post I created a manual trigger flow. In the trigger text parameter I used similar content as your email body and then used the above formula in a compose
     
     

    Hope it helps!

     

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

    Thank you!

    Leoza

  • tom_riha Profile Picture
    tom_riha 9,930 on 25 Sep 2024 at 18:52:25
    How to extract only part of a line from an email (after the word email:)
    Hello,
     
    I prefer using the split(...) expression to extract piece of text, but you can use also slice(...) or substring(...) as explained in this article.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #9 Get Recognized…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,479

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,350

Leaderboard
Loading complete