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

Announcements

News and Announcements icon
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:
  • Sundeep_Malik Profile Picture
    6,501 on at

    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

    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,501 on at

    @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

    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. 

    error-flow.png
  • Sundeep_Malik Profile Picture
    6,501 on at

    @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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard