Skip to main content

Notifications

Community site session details

Community site session details

Session Id : mQnVDDc9u5p8VVIy1BHRXF
Power Automate - Building Flows
Unanswered

Extract string between 2 strings

Like (0) ShareShare
ReportReport
Posted on 16 Jan 2022 20:43:34 by 2

Hi,

 

I am having some issues trying to figure this out:

When converting an email to HTLM, then removing the empty lines from the array I get something like this:

Note this is only a sample with the relevant information:

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

"Nom",
"Doe",
"Prénom",
"John",

"Fonction",

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

 

The value I am interested is "Doe" and "John", however when I try the "starts with" function I get this output:

 

SmittAuthy_1-1642365411907.png

 

So my question is: how can I get "Doe" instead of "Nom"? Can I select the string between "Nom" and "Prénom" to get that?

 

Thank you for your help !

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 16 Jan 2022 at 23:24:34
    Re: Extract string between 2 strings

    Hi @SmittAuthy 

     

    I have given the answer based on your original query. Looks like you don't have consistent format of email body.

     

    Thanks

  • SmittAuthy Profile Picture
    2 on 16 Jan 2022 at 23:20:58
    Re: Extract string between 2 strings

    Thank you @abm for your help!

     

    I tried using the "outputs('Compose')" expression, however the emails received have the same layout, but sometimes have text before the information that I want to extract.

     

    So the "outputs('Compose')" expression isn't working all the time.

    -

    My thinking was: maybe there is a way to get the "Nom" line number and extract text from the next line? Something like n+1?

  • abm abm Profile Picture
    32,464 Most Valuable Professional on 16 Jan 2022 at 22:45:15
    Re: Extract string between 2 strings

    Hi @SmittAuthy 

     

    image.png

     

    Above you can see I have added the expression with index which is one and it should return Doe. The index starts from zero onwards.

     

    So if you want Doe and John then you need to use the below expression

     

    outputs('Compose')[1]

     

    outputs('Compose')[3]

     

    Thanks

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 51

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 37 Super User 2025 Season 1

#3
Chriddle Profile Picture

Chriddle 21 Super User 2025 Season 1

Overall leaderboard
Loading started