Community
    • Login

    Enhance the search options

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 3.1k 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.
    • Prabhu PP
      Prabhu P
      last edited by

      If I search for a string in a file and if that string occurs twice in a line, then in the search result pane, it will show two lines with that occurrence of the string highlighted. Requesting an option in search window to unify highlighting in same line rather than highlighting in duplicated lines.

      1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank
        last edited by

        This feature request has been already adressed here

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • Scott SumnerS
          Scott Sumner
          last edited by

          Here’s a semi-workaround:

          If you want to do a Find All on the string “abc”, do a regular expression search for ^.*?\Kabc

          Although this won’t highlight all of the matches, it only puts a line with MULTIPLE occurrences of “abc” in the search results pane ONCE. It will highlight only the first match on the line.

          1 Reply Last reply Reply Quote 1
          • guy038G
            guy038
            last edited by guy038

            Hello Prabhu and Scott,

            Scott, nice work-around, indeed ! I upvoted for it.

            Prabhu, there is, also, an other possibility :

            • Select the Search - Mark… menu option

            • Type abc, in the Find what : zone

            • Check the Bookmark line and the Purge for each search options

            • If necessary, check the Match case and Wrap around options

            • Select the appropriate search mode

            • Click on the Mark All button

            • Then, select the Search - Bookmark - Copy Bookmarked Lines menu option

            • Open a new tab ( CTRL + N )

            • Finally, paste the bookmarked lines ( CTRL + V )

            However, my method has a disadvantage : it does NOT copy the line numbers, of the matched lines :-((

            So, finally, we’re all agree that an option to get ONLY ONE line, with the multiple matched strings highlighted, would be welcome !!

            Best Regards,

            guy038

            P.S. :

            I’ve just thought about an other way to get the line numbers, but not the highlighting, unfortunately :

            • Look for any occurrence of abc and send the results to the Find result pane, clicking, as usual, on the Find All in Current Document button

            • Select all the lines found, in the Find result pane, with the mouse

            • Copy these lines with a CTRL + C action

            • Open a new tab ( CTRL + N )

            • Paste these lines with a CTRL + V action

            • Finally, perform the S/R, below, with the Regular expression search mode checked

            SEARCH (?-s)(^\h*(Line \d+:).*\R)(?:^\h*\2.*\R?)+

            REPLACE \1

            Et voilà ! You get each line, of the list, only once :-)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors