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 / First words from each ...
Power Automate
Unanswered

First words from each line

(0) ShareShare
ReportReport
Posted on by 49

Hello guys,

I have a text in the flow that looks like this 

abc1234kn bj 5 34k

abd1234kn bj 6 32n

I need to extract the first word from each line to populate Run Scrip later. 

I used this expression first(split(outputs(Compose), ' ')), but it extracts word only from the first line.

Thank you, appreciate your help.

 

Categories:
I have the same question (0)
  • ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @AK89 

     

    Here is the sample flow.

     

    I have stored input in the compose action:

    ManishSolanki_0-1710245202568.png

    abc1234kn bj 5 34k
    abd1234kn bj 6 32n

    Next, add "Select" action to get the array of first word for each line. You need to add an expression to split the input by line feed and then we would again use expression to extract the first word from each line:

    ManishSolanki_1-1710245323691.png

    split(outputs('Compose'),decodeUriComponent('%0A'))

    Click "Switch Map to text mode" button on the right side of Map parameter and enter the below expression in the whole textbox:

    first(split(item(),' '))

     

     

    Output:

    ManishSolanki_2-1710245414046.png

     

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • AK89 Profile Picture
    49 on at

    Hello, Manish.

    Thank fir you respond, it works. The only thing us when I try to populate word document the result comes out like this.

    1000035350.png

  • Verified answer
    ManishSolanki Profile Picture
    15,091 Super User 2025 Season 2 on at

    Hi @AK89 

     

    Pls add a compose action to join the array elements for creating a string separated with comma. You need to write an expression for this. Expression needs to be added in the expression box:

    ManishSolanki_0-1710334924651.png

    join(body('Select'),', ')

    Pls replace the separator in place of comma as per your choice.

     

    You could further pass the output of compose action for creating word file.

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • AK89 Profile Picture
    49 on at

    Thank you very much  it's working

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