Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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",

  • LeeHarris Profile Picture
    1,026 on at
    Re: Parsing HTML with many of same delimiter in text blob

    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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1