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 / Extracting variable le...
Power Automate
Answered

Extracting variable length string from PDF multiple occurences

(0) ShareShare
ReportReport
Posted on by 23

I am using Power Automate Desktop. I have a PDF file containing multiple rows of invoice numbers and amounts with a total line by vendor. There are several vendors / total amount lines in the file. The amounts are of variable length. I populate an Excel sheet with the total amount.

I used the CROP function to find the value between text "Total for Vendor" and "Next Vendor".

The first occurence works perfectly.

How can I advance to the next occurence of the text "Total for Vendor" and CROP the amount? It seems CROP starts at the top of the file each time, so I keep retrieving the same amount.

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Instead of using Crop text, use Parse text and enable regular expressions. You can then retrieve all instances of the same pattern from a blob of text into a list.

     

    If you are not familiar with regex, we can likely help you build it, if you provide a sample text as extracted from the PDF file, with the details of the specific values you want to extract.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • StanM Profile Picture
    23 on at

    Hi, Agnius, thanks for your reply.

    I am not familiar with regex.

    Attached are some sample data, I am trying to retrieve the $ amounts. For Parse text I search for "Total for Vendor". Then I increase position by a number to get to the first character of the amount. Since each amount is a different length, when I use Get subtext and enter a fixed length, I may pick up text from "Next Vendor" 

    stan_learning_0-1695221959457.png

     

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You can try using the following regex:

    (?<=\$)(\d+,)?\d+\.\d+

    Put this into the Parse text action, and make sure you enable regular expressions.

    Also, disable the toggle that extracts the first occurrence only.

     

    This will result into a list of matches in a variable called %Matches%. It will contain all the amounts from the text blob.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • StanM Profile Picture
    23 on at

    Thanks, Agnius, this worked well !!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard