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 / Extracting link as is ...
Power Automate
Answered

Extracting link as is from dynamic text

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I have a flow that retrieves text from emails. This text is dynamic, meaning it could contain several lines, or no lines. See below for example. I just want to extract the link as is (not including the [ or ] characters). The output currently has several blank lines below the link, and the "View full incident details" above the link is sometimes "View 1 previous incident update" or "View # previous incident updates". Is there a way to only extract the link itself?

 

PeterZigante_0-1660567624411.png

 

My current option would be to create IF statements searching the output for "Full incident details" , " Previous incident update" , and "previous incident updates" then trim based on that. But I think the must be a more efficient/easier solution.

 

Categories:
I have the same question (0)
  • Unknown geen idee Profile Picture
    1,757 on at

    Dear PeterZigante,

     

    Could you not just convert the whole output to a string and then with a split function (Compose) extract the link between the '[' and ']' symbols? You could first find the index point based on '[https:' and '...]', that should be pretty foolproof.

     

    Happy flowing,

    Koen

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I thought about that, but the text is dynamic, in the screenshot i showed the first line being "Image removed by ... with the .jpg inbetween [ and ]. Sometimes it is only one line, other times this could be 3 or 4 lines. I shortened it as much as i can, now i need to get whatever is between the last square brackets. I was wondering if there was a find link or extract link.

     

     

  • Unknown geen idee Profile Picture
    1,757 on at

    Dear Peter,

    I wonder why you are so concerned with the lines ... with the Slice function as part of the String functions (Expressions under Compose action) you can define a subset of a string based on index points.

    If you first use the Index function based on for example 'http' or some other unique element you can define exactly at which character in your entire string (regardless the total number of lines) you should start/stop the slice .... and thereby capture your link.

     

    Hope this helps,

    Happy flowing.

    Koen

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi Koen,

     

    I have tried this, using the output from screenshot as the first part, then the '[http' as the second, and the ']' as the end. But it says the below error.

    Unable to process template language expressions in action 'Compose' inputs at line '0' and column '0': 'The template language function 'slice' expects its second parameter to be an integer. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#slice for usage details.'.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    *Update, i used the split command, using "[https:" and "]" but because i needed https: for the link to work, i just added it afterwards using the output from the initial compose. 

    So it works like this. 

     

    Text to remove [sampletext.jpg]

    More TEXT[to remove]

    [https://urldefense.com ...]

     

    then using Split in a compose based on [https: i was left with below output

    //urldefense.com... 

     

    then just added https: in another action and i was left with below with nothing before or after it

    https://urldefense.com...

  • Unknown geen idee Profile Picture
    1,757 on at

    Dear Peter,

    If it works .... it works.

    BTW, you can easily manipulate the output from 'Index' by adding a number of characters before or after ... in this you can manipulate the position of the slice.

    BTW, you can convert any string to integer by int() function.

     

    If this was a solution to your problem, please indicate in the thread.

    Happy flowing,

    Koen

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for the feedback. My issue was that i am unsure the length of the link so i did not want to cut it off, i prefer using string instead of integers. For the moment, it seems what i mentioned does what i need since the text is not always going to be the same, sometimes it will be slightly different. The only constant will be the "[https://urldefense" so using that makes more sense. Thanks again!

  • v-liwei-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    You can use the split function, with https as the delimiter. 

    Finally, use the concat function to connect the obtained result with https.

    I have made a test for your reference:
    1.

    concat('https',first(split(last(split(outputs('Compose_2'),'https')),']')))

    vliweimsft_0-1660894585938.jpeg

    2.

    vliweimsft_1-1660894616819.jpeg

     

    Best Regards,

    Levi

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard