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 / Line break or paragrap...
Power Automate
Unanswered

Line break or paragraph - regex in text searching

(0) ShareShare
ReportReport
Posted on by 6

Hi

while working with Parse Text, I am trying to get SE 22  below  full string

 

BENEFICIARY'S PROFORMA INVOICE NO. SE
22200015 DATED: 19/01/2022

 

Due to line break or paragraph , Parse Text unable to give position of text.

Kindly advise how i will get the text position of  SE 22200015

 

Thank you.

Vedkumar

I have the same question (0)
  • UK_Mike Profile Picture
    on at

    Im still on my learn path re regex.

    But you could do it twice, positive look ahead for the BENEFICIARY'S PROFORMA INVOICE NO. SE

    Positive look behind for the 22200015 DATED: 19/01/2022.

    Then you have 2 separate variables to do whatever.

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I thought regex new line was /n

  • vedkumar Profile Picture
    6 on at

    I tried but it is not working.

    advised if another solution is there?

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    1). Am I correct that the trigger is “Beneficiary’s ProForma Invoice No.”?

     

    2.  Is the 2nd row’s first 8 digits always what you are looking for?

     

    3.  Is the Alpha characters on the right side of row one always 2 characters?

     

    If so, you should have all the text in a list format. If not, then SplitText by new line to convert the text variable to a list variable. 

    Now, you can do this:

     

    Loop 0 to %List - 1% increment of 1
        If %List[LoopIndex]% = “Beneficiary’s ProForma Invoice No.”

            Get Subtext from %List[LoopIndex]% 

                Starting position:  %List[LoopIndex].Count - 2%

                Ending position:  End of text

                ‘Note:  if you are getting white characters at the end of “SE”, ‘trim text %List[LoopIndex]% of all white characters at the end of text’ before the IF.
            Get Subtext from %List[LoopIndex] + 1%

                Starting position:  start

                # of characters:  8

        End (IF)

    End (Loop)

  • UK_Mike Profile Picture
    on at

    Try this...

     

    1st regex

    (?<=BENEFICIARY'S\sPROFORMA\sINVOICE\sNO.\s).*

     

    2nd regex

    .*(?=\sDATED)

     

    Output

    Screenshot 2022-02-07 134541.png

  • Roger_Katsu Profile Picture
    97 on at

    Use RegExt \s means Space, \n means new line.

    Roger_Katsu_0-1666591074968.png

     

    Roger_Katsu_1-1666591104059.png

    I tried in my PAD flows, it worked well.

     

  • Jamar_Forsythe Profile Picture
    Microsoft Employee on at

    I always use Regex101 to test and validate (No one can remember all those rules 😂).

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    There you go.

     

    momlo_0-1666862681208.png

     

    momlo_1-1666862805273.png

     

     

    Or, if SE is not constant but "NO." and "DATED:" are then use positive and negative lookahead to get the value:

     

    momlo_2-1666863026730.png

     

    See it live here:

    https://regexr.com/7121e

     

    If \n does not work in PAD, replace it with \s\s

     

    UPDATE

     

    Yeah.. PAD still does not understand \n in analyze text action (but it does in replace text action lol), here is working code:

     

    SET Text TO $'''BENEFICIARY\'S PROFORMA INVOICE NO. SE
    22200015 DATED: 19/01/2022'''
    Text.ParseText.RegexParseForFirstOccurrence Text: Text TextToFind: $'''(?!NO\\s)[a-zA-Z]+\\s\\s\\d+(?=\\sDATED:)''' StartingPosition: 0 IgnoreCase: False Match=> Match
    Text.Replace Text: Match TextToFind: $'''\\n''' IsRegEx: True IgnoreCase: False ReplaceWith: $'''%''%''' ActivateEscapeSequences: False Result=> Replaced

     

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

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 780

#2
Valantis Profile Picture

Valantis 668

#3
Haque Profile Picture

Haque 601

Last 30 days Overall leaderboard