Community
    • Login

    Let result lines for text search pattern appear only once even if there are more occurrences?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 3 Posters 348 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.
    • Claudia SvensonC
      Claudia Svenson
      last edited by

      I open a big text file in NP++ and search (after Ctrl+F) for occurrences of a certain pattern e.g. “foobar”.

      Then all lines (in current file) are listed which contain the pattern

      Unfortunately a lines is listed twice if the line contain the pattern two times.
      So

      one two three foobarfour five 22foobar six
      one two three foobarfour five 22foobar six

      appears two times in result list.
      Is there a way to to let NP++ only list a line once if it contains the pattern AT LEAST one time?

      If not: Can this be implemented in the next release?

      Thank you
      Claudia

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Claudia Svenson
        last edited by

        @Claudia-Svenson

        Is there a way to to let NP++ only list a line once if it contains the pattern AT LEAST one time?

        Not really.

        But, depending upon what you are doing, maybe it helps to use the bookmarking feature (see the Mark tab of the Find window), which will mark a line once no matter how many hits it contains. Then you could jump between the bookmarks to examine the lines. Downside: This method won’t highlight the matched part of the line for you.

        1 Reply Last reply Reply Quote 2
        • Claudia SvensonC
          Claudia Svenson
          last edited by

          Ok.

          is there an official Feature Request email or subforum where I can apply for implementing this feature?

          It shouldn’t be too difficult.

          1 Reply Last reply Reply Quote 0
          • Terry RT
            Terry R
            last edited by

            @Claudia-Svenson said in Let result lines for text search pattern appear only once even if there are more occurrences?:

            It shouldn’t be too difficult

            Unless you are a software developer you have no idea on how complicated it might be.

            But if you can read one of the posts in our FAQ section, namely
            FAQ Desk: Feature Request or Bug Report
            That will give you some direction.

            Terry

            1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn
              last edited by

              A little research shows that there are many outstanding requests for this type of feature. During the research I saw the nice workaround that is proposed. Here is how it works on your data:

              one two three foobarfour five 22foobar six
              one two three foobarfour five 22foobar six
              

              First, your typical search (for foobar) and its result is shown:

              dcd49156-f770-4238-ad45-13d18f708f58-image.png

              Notice, each line appears TWICE in the Find result output.

              Now, the workaround:

              • change Find what to `foobar(?-s).*
              • change _Search Mode to Regular expression

              Obtain:

              3d49dd9d-7e07-41b2-af62-4fcb4e514a25-image.png

              Notice each line in the source file occurs only ONCE in the Find result output.

              1 Reply Last reply Reply Quote 2
              • Alan KilbornA
                Alan Kilborn
                last edited by Alan Kilborn

                @Alan-Kilborn said in Let result lines for text search pattern appear only once even if there are more occurrences?:

                change Find what to `foobar(?-s).*

                Bit of an error here, in formatting; THIS:

                Now, the workaround:

                • change Find what to `foobar(?-s).*
                • change _Search Mode to Regular expression

                SHOULD BE:

                Now, the workaround:

                • change Find what to foobar(?-s).*
                • change Search Mode to “Regular expression”
                1 Reply Last reply Reply Quote 3
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors