Community
    • Login

    When finding in files is it possible to show more than one line?

    Scheduled Pinned Locked Moved General Discussion
    2 Posts 2 Posters 21 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.
    • P Offline
      petey200
      last edited by

      I looked around through AI and Google and did not see a solution to this. So apologize if this is an old rathole. However when searching using Find In Files. I would like to see more text above and/or below the keyword I am searching for. I am gathering with the default implementation of Notepad++ that is not possible but wondering if there was a plugin to help with this perhaps? Support for multiple keywords would be an additional plus.

      I was looking at some other off the shelf tools and Notepad++ would be a better place to execute this type of search imo. The file extensions I am looking through are non-standard but do contain searchable text but the tool I looked at did not allow other non standard extensions. So Notepad++ had a leg up there.

      Now if can get a bigger chunk of text surrounding the keyword returned. Problem is there are thousands of files I need to search through searching for the keyword “error” and I don’t have time to open each one to figure out more details about the error.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @petey200
        last edited by

        @petey200 ,

        The Search Results panel is designed to only show one line per match (even if you do a search expression that matches text that crosses over lines, it will only show the first line of the match). There isn’t a way to increase context.

        Support for multiple keywords would be an additional plus.

        The existing regular expression (regex) feature already handles that.

        • Find What = \b(George|Gracie|whale)\b
          • the \b matches “word boundary” so it would match George but not Georgene, etc.
          • the (...) makes a group - without this logical group, the \b would have to be repeated at the beginning and end of each word, like \bGeorge\b|\bGracie\b|\bwhale\b
          • the | means “OR”
          • translated to english, this Find What means “match a boundary, then George or Gracie or whale, then another boundary”
        • Match Case = off
        • Search Mode = Regular Expression
        • . matches newline = off

        7274a6f0-798a-4c00-9466-d487a784e5af-image.jpeg

        –
        From our FAQ section, the Generic Regular Expression formula FAQ links to a post Generic Regex: Logic Gates for Regular Expressions which explains how to match lines with AND, OR, Exclusive-OR, and similar logical constructs.

        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