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 Platform Community / Forums / Power Automate / Parsing HTML with many...
Power Automate
Unanswered

Parsing HTML with many of same delimiter in text blob

(0) ShareShare
ReportReport
Posted on by 4

Hello everyone. Trying to parse a value from a delimited name value pair, using principally the substring and indexof functions.

 

Here's the shortened text string: (there's about 30 name/value pair variations in total

Lastname:ValueIs123|
Firstname:ValueIs456|

 

and using this, when only the "Lastname:ValueIs123|" is in the text blob is fine, but fails when I add the second name/value pair because the pipe is no longer unique. I cannot rely on other suppliers to meet an XML syntax format because they currently use colon delimiter for the defined name property and pipe delimiter for the end of the value.

 

How do I do this, to intruct the expression to look for the next occurence of pipe based upon a defined start point (indexof)??

 

substring(triggerBody()['text'],(add(indexof(triggerBody()['text'],'Lastname:')),9),(sub(indexof(triggerBody()['text'],'|'),(add(indexof(triggerBody()['text'],'Lastname:')),9)))

 

----------------

 

If I use XML syntax name/value pairs to prove it works.

 

substring(triggerBody()['text'],add(indexof(triggerBody()['text'],'<Lastname>'),10),sub(indexof(triggerBody()['text'],'</Lastname>'),add(indexof(triggerBody()['text'],'<Lastname>'),10)))
 
substring(triggerBody()['text'],add(indexof(triggerBody()['text'],'<Firstname>'),11),sub(indexof(triggerBody()['text'],'</Firstname>'),add(indexof(triggerBody()['text'],'<Firstname>'),11)))

 

against array

<Lastname>Alpro</Lastname>

<Firstname>No-latte</Firstname>

 

I get:

 

  "subject": "Alpro",

  "notetext": "No-latte",

Categories:
I have the same question (0)
  • LeeHarris Profile Picture
    1,026 on at

    Hi @rjd2703 

     

    Depending on what it is you need to use the values for later in your Flow, you may be able to make use of the Split expression.

     

    split('Lastname:ValueIs123|Firstname:ValueIs456|','|')
     
    This should produce an array with 3 items (the last item is blank because of the final | in the string).
     
    You can combine this with the JSON Parse action to get something that is a bit easier to work with.
    Use the following split expression in a compose action
    concat('{"items":',split('Lastname:ValueIs123|Firstname:ValueIs456|','|'),'}')
    Then use a Parse JSON action with the following schema
     
    {
     "type": "object",
     "properties": {
     "items": {
     "type": "array",
     "items": {
     "type": "string"
     }
     }
     }
    }
    You will then be able to loop through each of the items, using your substring expressions to work out what property they are.
     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard