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 / How to extract text fr...
Power Automate
Unanswered

How to extract text from a variabl?

(0) ShareShare
ReportReport
Posted on by 32

Hi All!

Can someone please advice how to extract the text I need from this variable? The numbers and the amount of rows are differnent in each loop iteration. But I need the teext from rows in between row with "TASK NAME:" and "O the source" 🙂

mktranslation_0-1643472088035.png

 

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Looks like you are in a text variable. Split text by new line to a list variable %SplitText%.


    Create List %ExtractedText%

    Loop 0 to %SplitText.Count - 1% increment of 1

       Get Subtext %SplitText[LoopIndex]% from start to 10 - Save as %SubText%

        If %SubText% equals “TASK NAME”

            Set %CurrentExtract% to %SplitText[LoopIndex + 1]%
            Add %CurrentExtract% to List %ExtractedText%
        End(If)

    End(Loop)

     

    Now all your extracted texts are in a list in the same order that you processed each iteration of combing through the texts. 

  • UK_Mike Profile Picture
    on at

    I could have sworn that regex was the way to go on this one but thats just opened up endless possibilities for me.

    Reading Pdfs with regex is great but needs a separate regex per pdf.

    This just needs the vars editing, am I right in thinking this ?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Right. So, regex would be faster too, cuz this is a lot of steps for the bot to take.  Unfortunately, I don’t know regex and have only used it a handful of times. Fortunately, Task Name looks to be only about 18 lines down, so it shouldn’t be too bad. You would have outer loop around everything I gave you to run through each document, Like:

     

    Get Files

    Create List %ExtractedText%
    Loop 0 to %Files.Count - 1%
       -Do everything that I gave you last time except Create List, cuz that needs to happen outside of the Loops.
    End Loop

  • UK_Mike Profile Picture
    on at

    Going to have a play around with this, 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard