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



  • 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



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



  • Ok.

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

    It shouldn’t be too difficult.



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



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



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

Log in to reply