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

Community site session details

Session Id : FRvgNm1FCFgp3WyGPeDKBx
Power Automate - Building Flows
Answered

Extract URL from Email body

Like (1) ShareShare
ReportReport
Posted on 17 Sep 2020 02:38:35 by 30

Hi All,

 

Need some help with extracting the URL from the email body below. I have a flow which converts the received email body  HTML to text and I tried to use split to extract it but its not working, can anyone advise the best way to achieve this?

aanyoti1_0-1600310070861.png

 

 

  • carlilelance Profile Picture
    351 on 01 Nov 2023 at 19:39:32
    Re: Extract URL from Email body

    This should be the accepted answer because it is by far more dynamic than the others. The regex might look ugly, but it doesn't rely on specific formatting (outside of it being a link). With an email, I guarantee, no one is going to follow any formatting rules. 

  • Adomin Profile Picture
    8 on 02 Feb 2023 at 07:27:08
    Re: Extract URL from Email body

    @Jay-Encodian 
    スクリーンショット 2023-02-02 114851.png

  • Adomin Profile Picture
    8 on 02 Feb 2023 at 07:18:12
    Re: Extract URL from Email body

    @Jay-Encodian 👆

  • Adomin Profile Picture
    8 on 02 Feb 2023 at 07:13:12
    Re: Extract URL from Email body

    Hello! I need help.
    When I tried to reproduce your flow, I sometimes got this kind of error. What could be the possible causes?

  • crt8735 Profile Picture
    4 on 08 Apr 2022 at 21:55:28
  • microsoftie Profile Picture
    4 on 27 Jul 2021 at 19:01:06
    Re: Extract URL from Email body

    I have followed followed your step by step and I am still having the same issue as the OP. 

     

    my last compose raw output is: 

  • Verified answer
    Jay-Encodian Profile Picture
    2,920 on 22 Sep 2020 at 09:53:21
    Re: Extract URL from Email body

    Updated Sept 23:

    There is now a much simpler solution available to extract a URL(s) from the body of an email (or any other text value) by using the Encodian Utility - Extract URL's from Text action. 

    Consider this simple flow:

    1.png

     

    Which extracts all the contained URL's within the email:

    2.png

     

    You can a further flow example and instructional video on this post: Extract URLs from Text and Documents with Power Automate

  • aanyoti1 Profile Picture
    30 on 22 Sep 2020 at 08:56:52
    Re: Extract URL from Email body

    Hi @Jay-Encodian,

     

    See below raw output of the HTML to Text:

    {
     "statusCode": 200,
     "headers": {
     "Pragma": "no-cache",
     "Transfer-Encoding": "chunked",
     "Vary": "Accept-Encoding",
     "Strict-Transport-Security": "max-age=31536000; includeSubDomains",
     "X-Content-Type-Options": "nosniff",
     "X-Frame-Options": "DENY",
     "Timing-Allow-Origin": "*",
     "x-ms-apihub-cached-response": "false",
     "Cache-Control": "no-store, no-cache",
     "Date": "Fri, 18 Sep 2020 14:51:08 GMT",
     "Set-Cookie": "ARRAffinity=7007353e6908e52d8a882a0d248752a54a5a3b25dfdde97fabc8ecca38b8d51c;Path=/;HttpOnly;Domain=conversionservice-ne.azconn-ne.p.azurewebsites.net",
     "Content-Type": "text/html; charset=utf-8",
     "Expires": "-1",
     "Content-Length": "127"
     },
     "body": "https://12345.abcde.com/a3G5I000000bxkP\n\nPlease click link above to approve or reject this record. \n\nThank you!"
    }

     

  • Jay-Encodian Profile Picture
    2,920 on 21 Sep 2020 at 06:21:19
    Re: Extract URL from Email body

    Hi @aanyoti1 ... hmmm, same data with the expressions I have already provided to you

    1.jpg

     2.jpg

     

    substring(variables('Text'),lastIndexOf(variables('Text'),'https'))

    substring(outputs('Html_to_text')?['body'],0,indexOf(outputs('Html_to_text')?['body'],' '))

     

    Can you please click on the 'Raw outputs' from the Html to Text action... I think there is some extra data in the payload.

  • aanyoti1 Profile Picture
    30 on 20 Sep 2020 at 21:19:56
    Re: Extract URL from Email body

    Hi @Jay-Encodian,

     

    See below:

     

    Hello,
    
    Your Approval has been requested for 
    Products in the Basket: https://mydomain.12345.com/a3G5I000000bxkP
    
    Please click link above to approve or reject this record. 
    
    Thank you!

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2