• Login
Community
  • Login

Filtering my Find in Files search: help?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 2.4k 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.
  • G
    Greg Smith 0
    last edited by Greg Smith 0 Jan 19, 2021, 7:03 PM Jan 19, 2021, 7:02 PM

    I need to exclude a set of files from a “Find in Files” search based on filenames containing the string “_bkup”.

    The files I am working with look like this:

    filename_bkupYYYYMMDD.html
    filename.html
    

    I need to exclude the first file and include the second file. I cannot filter based on file extensions, which is the approach shown in the Notepad++ documentation.

    The following tests failed to exclude the intended files:

    *.* ; !*_bkup*.html
    
    *.* ; !*_bkup????????.html
    

    Both of the file masks above return only the files I wish to exclude if I use them in a Windows Explorer search without negation.

    If anyone with more experience using this feature could provide some suggestions to put me on the right track it would be much appreciated. Is the search I want possible with this approach or do I need to use regex?

    P 1 Reply Last reply Jan 19, 2021, 7:16 PM Reply Quote 1
    • P
      PeterJones @Greg Smith 0
      last edited by Jan 19, 2021, 7:16 PM

      @Greg-Smith-0 ,

      I created those two files, with the contents equal to their filename, so I know both have an a in them.

      I searched for a with the filter *.* !*_bkup*.html (no semicolon needed, though it didn’t hurt things)
      8caf8db7-0106-4989-b77e-fb9632a6fdae-image.png . This only found

      Search "a" (1 hit in 1 file of 1 searched)
        C:\Users\peter.jones\Downloads\TempData\nppCommunity\20617\filename.html (1 hit)
      	Line 1: filename.html
      

      If I change the filter to *.*, it finds:

      Search "a" (2 hits in 2 files of 2 searched)
        C:\Users\peter.jones\Downloads\TempData\nppCommunity\20617\filename.html (1 hit)
      	Line 1: filename.html
        C:\Users\peter.jones\Downloads\TempData\nppCommunity\20617\filename_bkupYYYYMMDD.html (1 hit)
      	Line 1: filename_bkupYYYYMMDD.html
      

      So, it works for me, as expected.

      or do I need to use regex

      No, the filters box does not use regex

      BTW: my ? menu, Debug Info:
      Notepad++ v7.9.2 (64-bit)
      Build time : Dec 31 2020 - 04:01:34
      Path : C:\usr\local\apps\notepad++\notepad++.exe
      Admin mode : OFF
      Local Conf mode : ON
      OS Name : Windows 10 Enterprise (64-bit)
      OS Version : 1903
      OS Build : 18362.1256
      Current ANSI codepage : 1252
      Plugins : ComparePlugin.dll ExtSettings.dll HexEditor.dll LuaScript.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConsole.dll NppConverter.dll NppEditorConfig.dll NppExec.dll NppExport.dll NppFTP.dll NppUISpy.dll PreviewHTML.dll PythonScript.dll QuickText.dll RestApiToText.dll TagLEET.dll XMLTools.dll

      G 1 Reply Last reply Jan 19, 2021, 7:18 PM Reply Quote 1
      • G
        Greg Smith 0 @PeterJones
        last edited by Greg Smith 0 Jan 19, 2021, 7:19 PM Jan 19, 2021, 7:18 PM

        @PeterJones Thank you for this.

        I am using an older version:

        Notepad++ v7.8.1 (64-bit)
        Build time : Oct 27 2019 - 22:57:19

        I’ll update any try again.

        P 1 Reply Last reply Jan 19, 2021, 8:26 PM Reply Quote 0
        • P
          PeterJones @Greg Smith 0
          last edited by Jan 19, 2021, 8:26 PM

          @Greg-Smith-0 said in Filtering my Find in Files search: help?:

          I am using an older version:
          Notepad++ v7.8.1 (64-bit)

          That will do it. The “exclusion” filter wasn’t introduced until v7.8.2 (see release notes ). This was also mentioned in the online manual :
          -----
          As of Notepad++ v7.8.2, you can also exclude certain file patterns by prefixing the filter with a !
          -----

          G 1 Reply Last reply Jan 19, 2021, 9:05 PM Reply Quote 0
          • G
            Greg Smith 0 @PeterJones
            last edited by Jan 19, 2021, 9:05 PM

            @PeterJones I totally read that but didn’t realize the machine I’m using was out of date!

            1 Reply Last reply Reply Quote 2
            3 out of 5
            • First post
              3/5
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors