Community
    • Login

    Multi-file search: Show entire matched string, not just first matched line

    Scheduled Pinned Locked Moved General Discussion
    7 Posts 3 Posters 3.8k 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.
    • Eiren SmithE
      Eiren Smith
      last edited by

      When searching in multiple files, is it possible to display the entire matched string for each match in the list, not just the first matched line from each file?

      I need this so I can ensure my search criteria is perfect prior to doing a multi-file string replacement.

      1 Reply Last reply Reply Quote 0
      • Jim DaileyJ
        Jim Dailey
        last edited by

        Not sure what you are seeing, but if I do a find in files (or find in all open documents) I see all of the lines that match in all of the files.

        1 Reply Last reply Reply Quote 0
        • Eiren SmithE
          Eiren Smith
          last edited by Eiren Smith

          You’re right for some searches. However, my search matches text on multiple lines with one regex.

          For example, a few files contain:

          First line
          Second line
          Third line

          My regex is:

          First.*line

          That (being a greedy-mode regex) matches everything from"First" to the last instance of “line” – three lines of text matched.

          When I do that, I get what I reported – just the first line of the match (“First line”) showing in my “Find result” list. Not what I want.

          If I do a regex that has multiple single-line matches, those all display.

          I’d show a picture, but I don’t know where to host the pic. I don’t see an upload feature here.

          Any ideas, folks?

          Thanks.

          1 Reply Last reply Reply Quote 0
          • Jim DaileyJ
            Jim Dailey
            last edited by

            Oh, I see. I hadn’t tried a regex whose match spanned multiple lines. I’m guessing whomever wrote the code to display the find results didn’t consider such a case either.

            I don’t imagine there is any way (short of modifying the N++ code) to do what you want.

            1 Reply Last reply Reply Quote 0
            • Eiren SmithE
              Eiren Smith
              last edited by

              Thanks. Sorry to hear it. I guess I’ll test the regexes with grep instead, then later run them with Notepad++.

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

                @Eiren-Smith

                I wouldn’t do that…grep and Notepad++ use different flavors of regex engine. No guarantee that the results are going to be the same.

                1 Reply Last reply Reply Quote 0
                • Eiren SmithE
                  Eiren Smith
                  last edited by

                  Thanks, Scott. I later noticed that. Oh, well.

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