Community
    • 登入

    Collapse function - how to copy just the collapsed results from results window

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    14 貼文 6 Posters 17.6k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • J BlueJ
      J Blue
      最後由 編輯

      Thanks Claudia - * ** press mark all - ***unfortunately, the filename is not being copied as part of my select all into the new file, so it can’t be marked. The file name only appears in my results panel, is there a setting I need to check for using the results panel in a new file? ARRRGGH

      1 條回覆 最後回覆 回覆 引用 0
      • J BlueJ
        J Blue
        最後由 編輯

        Thanks Guy038 - *** Paste it, in the new file, previously created - ***the results panel is not being copied into the new file, it seems my results panel is not cooperating with normal editing functions, is there something I need to set to use the results panel in an editor?

        1 條回覆 最後回覆 回覆 引用 0
        • guy038G
          guy038
          最後由 編輯

          Hi J Blue,

          Oh ! I forgot to tell you that you must exclusively use the mouse to achieve the paste operation !

          So, the 5th step of my method, described in my previous post, should be :

          • Paste it, in the new file, previously created, EXCLUSIVELY by left clicking on the selection of the Find result panel and dragging it over the empty window of the new file

          BTW, I also updated, accordingly, my previous post, of course !

          It should work fine !

          Cheers,

          guy038

          1 條回覆 最後回覆 回覆 引用 0
          • J BlueJ
            J Blue
            最後由 編輯

            VOILA indeed, that worked! Thank you,

            1 條回覆 最後回覆 回覆 引用 0
            • guy038G
              guy038
              最後由 guy038 編輯

              Hi J Blue,

              I’m pleased that you’ve got the job done, at last !

              Just some explanations about the regex (?-is)(?:(?:^Search "|\tLine).*\R| \(\d+ hits?\))

              Moreover, thinking again about it, I slightly shorten its syntax and correct a possible error :-)


              So, the final and exact regex becomes (?-is)(?:^(?:Search "|\t).+\R| \(\d+ hits?\)$)

              • The two modifiers, (?-is) at the beginning of the regex ensure that this regex will be performed with the options :

                • No insensitive (?-i)
                • No Single line (?-s)

              whatever you set/unset the corresponding options Match case and . matches newline, in the Find/Replace dialog

              • The two characters ?: at the beginning of a group n (?:........) prevents the regex engine from backing up this group as the back-reference \n, for further use, in the search or the replacement regex

              • As a file CAN’T contain a Tabulation character in its name, neither a double quotes " character and, as any line found in the Find result panel, begins with a Tabulation character, the search, from the beginning of a line, of the strings Search " or \t followed by any non empty range of characters ( .+ ), followed, itself, by the End of Line character(s) ( \R ), will delete any line, different from an absolute pathname of a file ! ( (?:^(?:Search "|\t).+\R )

              • Then, we just have to suppress the string (## hits), at the end of each absolute pathname. As the round brackets must be escaped in order to be searched as literals, this part can be achieved with the regex \(\d+ hits?\)$, with a space before the characters \(.

              • We need to add the assertion $ meaning End of Line, just in case your would have created a file with the exact name, let’s say, Test (17 hits). Without the anchor $, it would delete the end of the filename ( Drive_Letter:\...\...\Test ) !

              • Finally, if you prefer to keep the first line, which shows the search contents and the statistics, about the hits and the files involved, just change the above regex by the regex (?-is)(?:^\t.+\R| \(\d+ hits?\)$)

              Cheers,

              guy038

              1 條回覆 最後回覆 回覆 引用 0
              • J BlueJ
                J Blue
                最後由 編輯

                And, Claudia’s suggestion works too. The key is mouse drag results to new file, thanks.

                1 條回覆 最後回覆 回覆 引用 0
                • iamhammerI
                  iamhammer
                  最後由 編輯

                  With Notepad++ v7.9.2

                  • Right-click anywhere inside the Search Results, and select Copy.
                    e4eed2a8-db91-43b9-b09c-4a49996828cf-image.png

                  • Paste into an new empty file.

                  • Ctrl+M to invoke the Mark tab

                  • Use this search query ^.*(hits?|searched)\)$ and click Mark All, then Copy Marked Text
                    86fd0d05-42e4-45af-8401-f37a7cd4414b-image.png

                  • Paste over the text that was previously pasted and then searched. The collapsed results are all that remain.

                  Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
                  • Alan KilbornA
                    Alan Kilborn @iamhammer
                    最後由 編輯

                    @iamhammer said in Collapse function - how to copy just the collapsed results from results window:

                    Right-click anywhere inside the Search Results, and select Copy.

                    Wouldn’t you have to select something first?

                    iamhammerI 1 條回覆 最後回覆 回覆 引用 0
                    • iamhammerI
                      iamhammer @Alan Kilborn
                      最後由 編輯

                      @Alan-Kilborn
                      Yes, you need to have a selection.

                      I’ve changed my colors around in the theme settings and haven’t yet found the balance I am looking for. It’s made it a bit more difficult to notice that I did indeed have a selection.

                      1 條回覆 最後回覆 回覆 引用 0
                      • haleba-hotmailH
                        haleba-hotmail
                        最後由 編輯

                        Old thread, but FWIW since I had the exact same issue:

                        View/Fold All

                        Unfold the top level to expose all second level folded items, then set bookmarks on the visible lines (do NOT try Invert Bookmarks: it looks like it only bookmarks the visible lines but actually marks ALL the lines)

                        Search/Bookmark/Copy Bookmarked Lines

                        Paste in new document.

                        Done

                        Notepad++_SelectFolded.jpg

                        1 條回覆 最後回覆 回覆 引用 0
                        • guy038G
                          guy038
                          最後由 guy038 編輯

                          Hello, @haleba-hotmail and All

                          I cannot reproduce your N++ behaviour. You must run an old N++ release !

                          With the v7.9.2 release ( note that the latest is v7.9.5 ) if I fold and bookmark, in any N++ XML configuration file, the <NotepadPlus> tag, then, after using the Search > Bookmark > Copy Bookmarked Lines option and pasting the clipboard contents in a new tab, I only get one line : the <NotepadPlus> line !

                          Best Regards,

                          guy038

                          1 條回覆 最後回覆 回覆 引用 0
                          • 第一個貼文
                            最後的貼文
                          The Community of users of the Notepad++ text editor.
                          Powered by NodeBB | Contributors