Skip to main content

Notifications

Power Platform Community / Forums / Building Flows / Extract a part from a ...
Building Flows
Unanswered

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

Posted on 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 26,301 on at
    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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 141,122

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,414

Leaderboard

Featured topics