Community
    • Login

    Search text, only in ranges in the line!

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 3.7k Views 2 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.
    • Nicolas MachadoN Offline
      Nicolas Machado
      last edited by

      Hi, I’m procesing text files with notepad++, because I need to correct them!

      for example I have this:

      19600018444989BERTOLO DANIEL SANDRO B° AGUA Y ENERGIA PLAN 10 M.C 1.0 5515
      320551B002600001067001 BVS513REPUESTO CHEVROLET 00000000100000001753700000000000000000000000
      320551B0026000010670020584212ACEITE HIDRO(NO SE PROVEE) 00000000150000000103600000000000000000000000
      220551B0026000010672707201796000184449890000019091000000000000000000000005400000000100151

      I want to search lines that start with “196”, only in the first 3 chars.

      Any idea?
      Best Regards

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS Offline
        Scott Sumner @Nicolas Machado
        last edited by

        @Nicolas-Machado

        Sure, if you do a regular-expression search for ^196, that should do it. The ^ part is what ties it to “start of line”.

        Nicolas MachadoN 1 Reply Last reply Reply Quote 0
        • Nicolas MachadoN Offline
          Nicolas Machado @Scott Sumner
          last edited by

          @Scott-Sumner Thanks that works perfect.
          Is there any way to also check length of the line: such as “start with 196 and lenght < 89” …

          Best Regards.

          Scott SumnerS 1 Reply Last reply Reply Quote 0
          • Scott SumnerS Offline
            Scott Sumner @Nicolas Machado
            last edited by

            @Nicolas-Machado

            One can certainly do that, but how long does this go on? Do I give you that solution and then you add yet another condition to it in a follow-up question? Ideally, you read my response to the first question in this thread and thought, That is really neat. I’ve got to figure out this regular expressons stuff!. And then you go off and do just that, with the various references available on the Internet. And then you are able to solve your own problems along these lines. This is really what I’m encouraging you to do, but I’m not opposed to helping you out on your current problem, if you are in a hurry to get wherever it is you are going. :-D

            So I might solve your new problem this way:

            Find-what zone: (?-s)^196.{0,85}$

            Basically what this does is say that after the 196 at the start of the line, there needs to be from zero to 85 other characters before the end-of-line is seen to have a match–anything else (e.g., a longer line than 88 total characters) will not be matched.

            Nicolas MachadoN 1 Reply Last reply Reply Quote 0
            • Nicolas MachadoN Offline
              Nicolas Machado @Scott Sumner
              last edited by

              @Scott-Sumner You are totally right, reg expression are still a mystery for me. I use it in a dummy way, chek email format, numbers. But to me is a pending issue. Thank you very much, you gave me more than I expect.

              1 Reply Last reply Reply Quote 1

              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