Community
    • Login

    New displaying of the "Search Results" panel

    Scheduled Pinned Locked Moved General Discussion
    1 Posts 1 Posters 18 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.
    • guy038G Online
      guy038
      last edited by guy038

      Hello, All,

      One minor drawback, when you display the Search results panel, is that the name of each file does not appear before the line number and the line itself !

      See, for example, this post : https://community.notepad-plus-plus.org/topic/21722/format-of-search-results

      Here is the way to realize this goal !


      Once any Search Results panel is displayed :

      • Hit the Ctrl + A shortcut

      • Hit the Ctrl + C shortcut

      • Open a new tab ( Ctrl + N )

      • Paste the Search Results contents in this new tab ( Ctrl + V )

      • Run the option Edit > Line operations > Reverse line order ( IMPORTANT )

      • Now, open the Replace dialog ( Ctrl + H )

      • Uncheck all box options

      • FIND (?-si)^\tLine\x20+(\d+)(?=(?s:.+?)^\x20\x20\u:.*\\(.+)(?= \())|^\x20\x20\u.+\R

      • REPLACE ?2\2\t\1\t

      • Check the ‘Wrap around’ option

      • Select the Regular expression search mode

      • Click on the Replace All button

      • Now, re-run the Edit > Line operations > Reverse line order option ( IMPORTANT )

      • Finally, save this new tab for future study within N++ or Excel !


      For a more appealing presentation within N++, if you have the Columns++ plugin, do the following actions :

      • Check the Elastic tabstops option

      • Run the Convert tabs to spaces option


      For example, I did a search of the word the, whatever its case, in Normal mode, on any .txt file af an USB key

      Search "the" (76665 hits in 498 files of 578 searched) [Normal]
      

      I got an INPUT file of 51,224 lines for about 10,2 Mb

      And, after the above process :

      • Reverse line order

      • Regex Replacement

      • Reverse line order

      Which took 66s, I got an OUTPUT file of 50,713 lines, for about 12 Mb, with filename, number and text aligned

      And in order to right-aligned the line numbers, do the following regex replacement :

      FIND (\d+)(\x20*)(?=\x20:\x20)

      REPLACE \2\1

      Voila !

      Best Regards,

      guy038

      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