Community
    • Login

    I need to delete anything before ANY number, AND the number in a line

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 1.7k Views 1 Watching
    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.
    • greg gregG Offline
      greg greg
      last edited by

      I need to make this:

      Cobrança recebida - fatura nr. 183893434 JOÃO FLORES
      Taxa de boleto - fatura nr. 183893434 JOÃO FLORES
      Desconto na tarifa - fatura nr. 183893434 JOÃO FLORES
      Cobrança recebida - fatura nr. 184029355 JOÃO FLORES
      Taxa do Pix - fatura nr. 184029355 JOÃO FLORES
      Desconto na tarifa - fatura nr. 184029355 JOÃO FLORES
      Cobrança recebida - fatura nr. 184569951 Proredes Int C E Servicos De Inf
      Transação via Pix com chave para PRO INT SER DE INF
      Cobrança recebida - fatura nr. 185197278 RUDNALDO FERNANDES DIAS DA SILVA
      Taxa de boleto - fatura nr. 185197278 RUDNALDO FERNANDES DIAS DA SILVA
      Desconto na tarifa - fatura nr. 185197278 RUDNALDO FERNANDES DIAS DA SILVA

      Becoming this:

      JOÃO FLORES
      JOÃO FLORES
      JOÃO FLORES
      JOÃO FLORES
      JOÃO FLORES
      JOÃO FLORES
      Proredes Int C E Servicos De Inf
      PRO INT SER DE INF
      RUDNALDO FERNANDES DIAS DA SILVA
      RUDNALDO FERNANDES DIAS DA SILVA
      RUDNALDO FERNANDES DIAS DA SILVA

      I guess if I manage to remove everything before numbers in a line AND remove the numbers aswell, it will solve 99,99% of my problem. For every 1000 lines there only one wont have that pattern with the numbers. This one will get highlighted in the dynamic sheet mounted with these data in a Google Sheet. I can fix that black sheep manually easypeasy.

      Terry RT 1 Reply Last reply Reply Quote 0
      • guy038G Offline
        guy038
        last edited by

        Hello, @greg-greg and All,

        Seemingly, you would like to delete from beginning of any line till the string fatura nr. followed with a number and a space character !

        However, in the line Transação via Pix com chave para PRO INT SER DE INF, the string fatura nr. does not occur. In that case, I supposed that you wanted to delete from beginning of line till the word para. Not totally sure about that !

        Thus, use the regex S/R :

        SEARCH (?-is)^.+ fatura nr\. \d+ (.+)|^.+ para (.+)

        REPLACE \1\2

        Best Regards

        guy038

        greg gregG 1 Reply Last reply Reply Quote 3
        • Terry RT Offline
          Terry R @greg greg
          last edited by Terry R

          @greg-greg said in I need to delete anything before ANY number, AND the number in a line:

          I guess if I manage to remove everything before numbers in a line AND remove the numbers aswell, it will solve 99,99% of my problem.

          As your request was really only to solve the 99.99% of the problem and you didn’t elaborate on the lines without numbers, I figured on solving your request in a different way to @guy038. I also think mine will help with the remaining 0.01% as well.

          1. Mark all lines that have no numbers in them at all, this was what you stated those 0.01% of lines do have in common. The regex to use (in the Mark function) is (?-s)^[^\d]+$ and click “bookmark line” so those lines will be marked with a blue sphere in the left margin. These lines won’t be changed by step #2 so need checking afterwards in step #3.
          2. To remove the portion of each line with a number run this regex on the whole document. Find What: (?-s).+\d+\s, Replace field to be empty. Click Replace all and that will remove all text up to and including the (single group of) numbers and a following space.
          3. In step #1 you marked the lines without numbers. You can now move through those lines using F2 (forwards) and Shift-F2 (backwards) to complete the edits. The “marking” process makes it easier to find the remaining lines to be edited.

          Terry

          greg gregG 1 Reply Last reply Reply Quote 3
          • greg gregG Offline
            greg greg @guy038
            last edited by

            @guy038 thanks for the reply, I ended up using the solution from Terry coz I tried it first and it worked just fine hehe

            1 Reply Last reply Reply Quote 1
            • greg gregG Offline
              greg greg @Terry R
              last edited by

              @Terry-R thanks Terry, I didnt even bothered to do it all, I just searched for (?-s).+\d+\s and replaced with nothing. worked like a charm, no backfiring at all, not even those 0,01% I was expecting to have.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors