• Login
Community
  • Login

work on several lines?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 412 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z
    Zen2cool
    last edited by Zen2cool Oct 5, 2019, 1:24 PM Oct 5, 2019, 1:23 PM

    Hello,

    I’m busy putting order in a txt file to prepare it for injection into a DB sql

    I have lines like this ( 40000) hence the efficiency of removing excess flow with notepad++

    the lines between =====+ and TOTAL EUROS are all different. I can have one as ten.

    +====================== Ticket 16392 =======================

    1 6X50G GO MY LITTLE ONE 2.89 2.89 2.89 B

    1 400G NEXP CAT STER STER 3.49 3.49 3.49 B

    TOTAL EUROS: 3.38

    Is it possible to collect just this with a regex?

    +====================== Ticket 16392 =======================

    TOTAL EUROS: 3.38

    Is it also possible to transform this (all my lines have different values)?

    B 21.00% 3.30 0.69 3.99

    to

    B 21.00%

    3.30

    0.69

    3.99

    I can’t afford to do any line by line

    Thank you.

    A 1 Reply Last reply Oct 5, 2019, 2:17 PM Reply Quote 0
    • A
      Alan Kilborn @Zen2cool
      last edited by Alan Kilborn Oct 5, 2019, 2:17 PM Oct 5, 2019, 2:17 PM

      @Zen2cool

      For the first part, I’m confused about what you want to transform to, so I’ll skip it…

      For the second part, you could try matching with this:

      ^(B\s\d{1,2}\.\d+%)\s(\d+\.\d+)\s(\d+\.\d+)\s(\d+\.\d+)

      And replacing with this:

      \1\r\n\2\r\n\3\r\n\4\r\n

      Search mode must be set to Regular expression, of course…but you seem to know that already.

      Z 1 Reply Last reply Oct 7, 2019, 10:44 AM Reply Quote 2
      • Z
        Zen2cool
        last edited by Oct 5, 2019, 2:26 PM

        Thanks,

        for the first part I just want to get what’s between

        +====================== Ticket xxxx ======================= and TOTAL EUROS: xxxx

        II have (xxxx) 40,000 tickets. !

        I’ll try the rest tonight.

        Thanks

        Rudy

        1 Reply Last reply Reply Quote 0
        • Z
          Zen2cool
          last edited by Oct 5, 2019, 3:14 PM

          I just want to keep what’s between

          +====================== Ticket 16392 =======================+
          TOTAL EUROS:

          and between these two lines I can have between 1 and 10 lines of text for example

          1 Reply Last reply Reply Quote 0
          • Z
            Zen2cool @Alan Kilborn
            last edited by Oct 7, 2019, 10:44 AM

            @Alan-Kilborn

            Thank you again, for the second part

            regards,

            1 Reply Last reply Reply Quote 0
            • G
              guy038
              last edited by Oct 20, 2019, 1:30 PM

              Hello, @zen2cool and All,

              If I understand you, correctly, you would like that, given the text :

              +====================== Ticket 16392 =======================
              
              1 6X50G GO MY LITTLE ONE 2.89 2.89 2.89 B
              
              1 400G NEXP CAT STER STER 3.49 3.49 3.49 B
              
              TOTAL EUROS: 3.38
              

              You expect the text :

              1 6X50G GO MY LITTLE ONE 2.89 2.89 2.89 B
              
              1 400G NEXP CAT STER STER 3.49 3.49 3.49 B
              

              Am I right about it ? If so, use this regex S/R :

              SEARCH (?-is)^.+Ticket.+\R\R|\RTOTAL EUROS.+\R

              REPLACE Leave Empty

              Best Reards,

              guy038

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors