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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

Replace text in flow

(0) ShareShare
ReportReport
Posted on by 2

 

How do we detect and replace embedded links as shown <a href="http://microsoft.com">Embedded link</a> to just show the url >> http://microsoft.com on email body.

 

I'm thinking if it's possible to get what is between <a href=" and ">

 

Categories:
I have the same question (0)
  • eliotcole Profile Picture
    4,363 Moderator on at

    Very briefly, the quickest and easiest way to extract all links from some html, where DATA_SET is your reference to your email HTML:

    1. Make a select action on skip(split(DATA_SET, 'href="'), 1)
    2. Create a key called url, with the value first(split(item(), '"'))

    This will create an array with all the urls of the text.

     

    EDIT - Here's an image of that working, in my example DATA_SET will be variables('html'):

    URLs.jpg

     

    If you want to take that further then it gets more complex, but theoretically, you can also extract the title or text that accompanies any links on the page.

     

  • NewLearner11 Profile Picture
    2 on at

    Thanks for helping to check. How about replacing the text? Do you think this is possible?

    Example as shown below.

    Past: <a href="http://microsoft.com">Embedded link</a>

    Future: <a href="http://microsoft.com">http://microsoft.com</a>

     

  • eliotcole Profile Picture
    4,363 Moderator on at

    @NewLearner11yeah, that's kind of what I was talking about when I mentioned this:

    If you want to take that further then it gets more complex, but theoretically, you can also extract the title or text that accompanies any links on the page.

    However, I now realise that I'd misread your request, and thought you purely wanted to extract the URLs, but what you actually want to do is replace their text with the URL link.

     

    Before I look at that, would you consider that potentially replacing that text could make the whole thing not make much sense, and that you might be better off putting the link in a bracket *after* the text that original had the link in it?

     

    So, using your example:

    PastThis has an <a href="www. startpage. com">embedded link</a> in it.
    FutureThis has an embedded link (<a href="www. startpage. com">www. startpage. com</a>) in it.

     

    For what it's worth, what you're after is essentially parsing, then manipulating HTML, and you'd need to go reasonably deep to accurately win at this on every pass. However if my memory serves correctly I think I might have worked this out for someone else recently. I'll check my solutions, bare with me.

     

    EDIT - OK. LOL ... The best solution might also be the easiest. I'll be back with a separate post in a second, I think, because there's a built in function that does exactly what I just said above. 😅😩😅

  • eliotcole Profile Picture
    4,363 Moderator on at

    OK, If you are OK with plain text, then the solution is super simple, and I'm an idiot for being so long winded ... SORRY!

    Solution

    Simply run the HTML through an "Html to text" action. It *literally* puts the URL next to the text.

    extract links.jpg

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard