Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Extract a part from a HTML string and store in a variable

Like (1) ShareShare
ReportReport
Posted on 12 Sep 2024 21:51:42 by 2
Hi, 
 
I want to extract a body and emails from the below string in power automate :
 
 
<div class="ExternalClassFCD14869688A40F2A3F9CD309841D521"><p>here is the comment <a href="mailto:; test1@xxx.com">surname, name</a>&nbsp;<a href="mailto:;test2@xxx.com"> surname, name</a></div>
 
I want to extract 'here is the comment' part as Body . 
And I want to extract those email ids and atore them in a variable which I defined already in the flow. (Here's only 2 mails are present, but it could be multiple) . 
 
I'm getting error. (Maybe cause of the &nbsp part present in the string) 
  • Suggested answer
    FLMike Profile Picture
    FLMike 29,371 on 13 Sep 2024 at 02:31:49
    Extract a part from a HTML string and store in a variable
    Hi,
     
    Please share your code, if you say you are getting an error, but do not share your flow, your code, the flow, the flow run, then its really just a waste of time for us to read.
     
    There are ways to help if we fully understand for instance
     
    to get the here is the comment
     
    you would use
     
    trim(split(split(mystring, '<p>')[1], '<a href')[0])
     
    So what this would do is split based on <p> which would give you 2 parts [0] and [1] where [1] now starts with her is the comment which is why after the first split I put the [1]
     
    Then I split by the <a href, which now creates 2 parts [0] which has your string you want and [1] which doesn't
     
    I used trim becasue there is a space after comment
     
    But the same type of parsing for your other stuff
     
    If this helps please mark so.
     
    just follow the same mindset of parsing
     
     
     
     
     
     
     
     
     
     
     

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,316

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,290

Leaderboard
Loading started