web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Extract a Speci...
Power Automate
Suggested Answer

How to Extract a Specific Line Containing an Email Address from an Email Body

(1) ShareShare
ReportReport
Posted on by 8

Hello,

I'm working on a flow in Power Automate to extract a specific line from the body of an email.

The goal is to retrieve an email address that appears after a specific keyword in the email body. For example, my output text from a substring action (outputs('Substring')?['body']) looks like this:

I want to extract only the email address "Dein.Doe@Aimsts.com" from this text. However, the format is not consistent and can sometimes be:

Is there a way to reliably extract only the email address regardless of these variations?

Thank you!

Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
    Hi, 
     
    Will the email domain always be the same as in your example?
     
    There are going to be loads of ways of how to do this, but if its the same then you could
     
    Here are the steps and total code
     
    1. Split by :
    Split(HTMLText, ':')
     
     
    2. Split(Split(HTMLText, ':'), '@Aimsts.com)')
     
    3. You want the first part of step 2 
     
    So you want to concat the
    4. concat(trim(split(split(HTMLText, ':'), '@Aimsts.com)')[0]), '@Aimsts.com')
     
    But the above splits it at the :, then splits it again by the Domain, gets the array index 0 and trims any spaces, then puts the EmailDomain back. since it was part of the larger [1] index of the split
     
    If you have to use other email address's then we can do it another way, you can also use regular expressions
     
  • EI-06081227-0 Profile Picture
    8 on at
    HI @FLMike, thank for your answer 
     
    yes the domain will always be the same but is it also can be retrieved if the the format only like this ?
     
    200
     
     
    www.Aimsts-pharma.com? 
     
    And is it possible to retrieved the email with different domain? 
     
  • Chriddle Profile Picture
    8,704 Super User 2026 Season 1 on at
    Since the "specific keyword" is not specific, it might be a good idea to check just for email addresses
    (OK, contains an "@" is not a thorough check, but you can easily extend this by looking for other characteristics if necessary):
     
    split(
    	replace(
    		outputs('Compose'),
    		decodeUriComponent('%0A'),
    		' '
    	),
    	' '
    )
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 462

#2
Vish WR Profile Picture

Vish WR 256

#3
David_MA Profile Picture

David_MA 242 Super User 2026 Season 1

Last 30 days Overall leaderboard