work on several lines?



  • 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.



  • @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.



  • 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



  • 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



  • @Alan-Kilborn

    Thank you again, for the second part

    regards,



  • 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


Log in to reply