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 / Regex with multiple Co...
Power Automate
Answered

Regex with multiple Condition !!

(0) ShareShare
ReportReport
Posted on by 56

Hello,

 

I'm looking to get the Regex if the extracted PDF consist of sentence "Line Description Net Billing" and to copy a line above "Total Amount Due:", The output I'm expecting is "Service rendered for Jul'22"

 

 

mohan2mm_0-1714438992474.png

 

I have the same question (0)
  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    Hi @mohan2mm 

    @Try this

    .*/n(?=Total Amount Due)

    Then you will get the line above to the total amount due 

    Then split it by spaces according to the requirement.

     

    Hope this helps

    Usha 

  • mohan2mm Profile Picture
    56 on at

    Hi Usha - Thanks for your response.

     

    I want to make sure if "Total Amount Due:" is present as part of the extract, Is this something I can give if condition and use the regex to extract the value ?

  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    Then extract whole text by using

    (?<Line Description Net Billing).*/n.*/n.*/n.*/n

    How many lines you needed use the same number of /n

    Then then the output will be stored in one variable 

    Then write if condition 

    Variable contains total amount due then do the process what you need...

    Else......what you need to do...

    By using the activities.

     

    If my answer helps you please mark it as a solution and like it which keeps me motivated.

    Thank you.

     

    Hope this helps

    Usha 

     

     

     

     

  • CU16071609-1 Profile Picture
    6,255 Moderator on at

    @mohan2mm 

     

    Just add if contains and include your pdfextract variable and you can follow parse text and use regex which usha mentioned above.

  • CU16071609-1 Profile Picture
    6,255 Moderator on at

    @mohan2mm 

     

    You can use the below approach which suits you more.

     

    1. If condition we are checking both line description and total due are exists in pdfextract variable then parse the text using regex we are extracting service details.

     

    Deenuji_0-1714455002115.png

    Deenuji_1-1714455076406.png

     

     

    Regex used: \b\d+ Service rendered for [A-Za-z]+'[0-9]{2} \d{1,3}(,\d{3})*\.\d{2}\b

     

    2. Another approach is we are just checking whether pdfextract data is starts with "line description" then parse our text.

    Deenuji_2-1714455162165.png

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     

  • mohan2mm Profile Picture
    56 on at

    Hi Deenuji - I have a couple of requirements in the same line.

     

    1. What is the Regex to find the address which is in between "Start" & "End" OR "End1"

     

    mohan2mm_0-1714472242076.png

    mohan2mm_1-1714472319123.png

     

     

  • UshaJyothiKasibhotla Profile Picture
    225 Moderator on at

    @mohan2mm 

    Try this the regex pattern is  

    (?<=Start:).*\n.*\n.*\n.*\n.*\n.*\n.*\n.*

     

    Hope this helps

    Usha

     

  • mohan2mm Profile Picture
    56 on at

    Hi Usha - My content could be more than 5 line items, which is not predictable, so want to consider "END" or "END1", so that the RegEx is more dyanmic.

  • Verified answer
    CU16071609-1 Profile Picture
    6,255 Moderator on at

    @mohan2mm 

     

    You can also consider crop text action for the same.

    Deenuji_0-1714474483969.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Verified answer
    eetuRobo Profile Picture
    4,583 Super User 2026 Season 2 on at

    Try this: (?<=Start:)[\s\S]*?(?=End(?:1)?)

    Should work with it ending both End1 and End

    eetuRobo_0-1714474614449.png

    eetuRobo_2-1714474696007.png

     

    Tip: if you need to get Regex you could try asking free version of ChatGPT and using this regex tester site: http://regexstorm.net/tester
    It usually gives wrong results at first but just tell it that it doesn't work and it gives you modified regex and usually after like 3-5 times of trying I get result that works. Also try giving it more info like that you are using Power Automate Desktop which uses regex with .NET engine and give it a sample of the text that the regex should work on.

    eetuRobo_3-1714474887904.png

     

     

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 266 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 160 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 134 Super User 2026 Season 2

Last 30 days Overall leaderboard