Community
    • Login

    Copy Find Result

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    find resultfindcopy and paste
    9 Posts 5 Posters 11.8k Views 2 Watching
    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.
    • fred339F Offline
      fred339
      last edited by

      I’m using a regex to Find lines in a file that’s open in NPP.
      The Find result shows 189 hits.
      And, that’s what seems to be displayed in the Find result window.
      However, I don’t seem to be able to Copy those results to create a new file with Paste.
      I was using Right Click and selecting Copy.
      It appears CTRL+C would be more like it. But that doesn’t work as expected either.
      I’m getting a few more lines than the original searched file when I Paste.
      What I need is a file that’s the same as the Find result.

      Thanks!

      PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 0
      • PeterJonesP Online
        PeterJones @fred339
        last edited by

        @fred339 ,

        After the Find In Files, your results window will have some number of lines.

        1. If you click on a single line and either RClick > Copy will copy just that single line.
        2. If you click on the line that says a file name, then the RClick > Copy action will copy the results from that file.
        3. If you do RClick > Select All then RClick > Copy , it will copy all the results, even across files.

        Note that any of those three methods, using the RClick > Copy, will not copy the Line ##: prefix to any of the lines.

        If for some reason you wanted that, you could do a more normal selection (click and drag to select, rather than just clicking on the line), and use Ctrl+C to do the copy, then it will have the Line ##: prefix included.

        If you need a file that is identical to the Find Results window, do a RClick > Select All, then use a standard Ctrl+C to copy.

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

          @fred339 said in Copy Find Result:

          I’m getting a few more lines than the original searched file when I Paste

          Maybe in addition to what @PeterJones said, you may want to right-click and do a Clear all BEFORE running a search. Then it is easy to copy only what you intend (I’m guessing this is the trouble you are having).

          1 Reply Last reply Reply Quote 2
          • caryptC Offline
            carypt
            last edited by

            i thought this “copying of search results” would be possible somehow already , but i see no way doing it . i am able to copy whole lines , but not simply the matching characters in the lines . i thought it was possible with the search-mark-function to let all findings be marked , and then grab(copy/paste) these marked matches . but again i am facing the fact , that marking doesnt mean selecting . so i cannot get hands on all the direct matches of eg [a-z] {3} , instead only on the lines containing the matches .

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

              @carypt said in Copy Find Result:

              so i cannot get hands on all the direct matches of eg [a-z] {3} , instead only on the lines containing the matches .

              Sounds like you might want to consider a destructive search. That’s where you use a regex to find the matches and leave ONLY that, everything else will be deleted. Or consider copying the find results and then work on that text in a similar fashion, removing all the “non-matching” text to leave ONLY what you wanted.

              Often there are several ways of obtaining the result you want. It doesn’t always have to be a single shot answer. Often doing it in several steps will be easier to understand, especially if passing the job onto someone else going forward.

              Terry

              1 Reply Last reply Reply Quote 2
              • caryptC Offline
                carypt
                last edited by

                yes , as workaround i was thinking for a while on deleting everything around the search matches . but in regex i struggled on defining the unmatched for deleting only this . now i am exhausted with no good result , :)

                Alan KilbornA 2 Replies Last reply Reply Quote 0
                • Alan KilbornA Offline
                  Alan Kilborn @carypt
                  last edited by Alan Kilborn

                  @carypt

                  There is a technique using regex for eliminating unwanted text in this THREAD. Since you gave no example of your own text, do some reading and see if you can make it work.

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

                    @carypt

                    Actually, I keep forgetting there is a relatively new command in Notepad++ to copy out marked text. It is found on the Mark tab. So, if you can mark the text you DO want, with a regex, you don’t have to be concerned about crafting a more complex regex to remove the text you don’t want.

                    1 Reply Last reply Reply Quote 3
                    • caryptC Offline
                      carypt
                      last edited by

                      Aaaahhhh ! yes , thats it . shame on me , i was not updated to 7.9.1 . i beg your pardon , but there is no excuse . shame on me

                      1 Reply Last reply Reply Quote 1

                      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