web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Search and return valu...
Power Automate
Unanswered

Search and return value from text

(0) ShareShare
ReportReport
Posted on by 107

I am trying to extract the value "test" from the following text by searching for "First name:" There is a line break after "test" that should be used to help extract the value "test". Not shown below in the example is I have randomized text and a line break that occurs before "First name". Can anyone help me out?

 

First name:

test

 

Last name:

 

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at
    Re: Search and return value from text

    Hey @Shaebert 

     

    I did it like this:

     

    Took your data in a compose.

    Then initialized a string variable with an empty line.

    Then used another compose. In that wrote the following expression:

    split(outputs('Compose'),variables('A'))[1]

    Sundeep_Malik_0-1669246267230.png

    Output:

    Sundeep_Malik_1-1669246315211.png

     

    I hope this helps 🙂

  • Shaebert Profile Picture
    107 on at
    Re: Search and return value from text

    I forgot to mention. The order the data is entered can sometimes rearrange. So the next variation of the data could have the last name and first name switched. 

  • Sundeep_Malik Profile Picture
    6,484 on at
    Re: Search and return value from text

    @Shaebert 

     

    Compose 2 Expression:

    split(outputs('Compose'),variables('A'))

    Compose 5 Expression:

    if(equals(outputs('Compose_2')[0],'First name:'),outputs('Compose_2')[1],outputs('Compose_2')[4])

    Sundeep_Malik_1-1669247068342.png

     

    Output:

    Sundeep_Malik_0-1669247030053.png

     

    I hope this will help. 🙂

    Going to sleep now 5am here.

    I hope I will get a thumbs up for this. Hehe 😉

  • Zak Profile Picture
    8 on at
  • Shaebert Profile Picture
    107 on at
    Re: Search and return value from text

    Hi Sundeep, no luck. I get the following error:

     

    InvalidTemplate. Unable to process template language expressions in action 'Compose_2' inputs at line '0' and column '0': 'The template language expression 'if(equals(outputs('Compose')[0],'First name:'),outputs('Compose')[1],outputs('Compose')[4]) ' cannot be evaluated because array index '4' is outside bounds (0, 0) of array. Please see https://aka.ms/logicexpressions for usage details.'.

     

    See the attached flow. 

  • Sundeep_Malik Profile Picture
    6,484 on at
    Re: Search and return value from text

    @Shaebert 

     

    In the image that you have posted, I see you have a link and its totally different from the sample you have given above. 

     

    Btw for yesterday, I had added one more word at the end:

    First name:

    test

     

    Last name:

    data

     

    Can you please send that link here, I will give you another solution.

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

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard