Skip to content
Doug P edited this page Nov 15, 2023 · 15 revisions

The Search window is the main application window.

The menu at the top of the window includes "Undo" button (enabled after replacing is performed), "Settings" menu, "Scripts" menu, "Bookmarks" button, and "About" menu.

Where to search

"Search in" section specifies the folder, file, or multiple folders/files that will be searched.
Use browse ("…") button to select a folder or files or type the path in the text field.

Tip: To search multiple folders or files, separate the paths with a comma or semicolon.

Tip: Drag and drop a folder from Windows Explorer onto the dnGrep window to set the search location.

Tip: Hold the Ctrl key down when dropping a folder to add it to the search location.

Tip: When "Folder" field is empty and directory path is in the clipboard, directory in the clipboard would be selected when browse ("…") button is clicked.

Tip: You can use Windows wildcards (* and ?) in the "Folder" field to filter sub-folders or files (in the last path segment only). For example, c:\results\log* will search only sub-folders with a name starting with "log".

File and folder name filters

When "Patterns to match" pattern is empty all files are included in search.
Use a filter pattern to select one or more file types to search.
Multiple patterns can be provided, separated by semicolon or comma: *.txt;*.xml;*.html
When "Patterns to exclude" is not empty, files or folders matching this pattern are excluded.

The pattern can be provided as either a Windows-style wildcard pattern or regular expression (e.g. te[a-z]t-fil?.*).
Switch between wildcard patterns and regular expression pattern using the selector in the file filters panel.
shebang style filter can be provided when searching Unix scripts (e.g. #!python;#!sh)

Note: When a file (not a folder) is selected for search in the "Folder" field, the "Patterns to match" field will be ignored.

"Search in archives" - select to search inside archive files (ZIP, RAR, 7z, and more).

Filter files

Click the "More…" button to show more file filters, in addition to the path and file extension filters.

Filter panel contains file-based filters including:

  • File size - limits files including in search by file size
  • Include subfolders - when selected files in subfolders are included in search
  • Max Depth - the maximum depth of folders to search
  • Include hidden folders - when selected files in hidden subfolders are included in search
  • Include binary files - when selected binary files are included in the search
  • Follow symbolic links - when selected, the file search will follow the links to additional directories
  • Date and time range - by file creation time or last modified time
  • Patten type - Regular expression, Wildcard, or Everything (shown if Everything is installed) applies to the "Patterns to match" and "Patterns to exclude" fields.
  • Filter - select a filter file to exclude files by pattern
  • Use .gitignore (shown if git is installed) - excludes files and folders as specified in .gitignore
  • Skip remote cloud storage files - to skip One Drive and similar storage.
  • Search parallel - enables or disables multi-threaded searches.
  • Encoding - can be used to specify file encoding; default value is "Auto detection"

What to search for

Search panel contains primary search criteria including search type:

"Bookmarks" buttons are used to create a new bookmark or associate the current search folder with a bookmark (see Bookmarks section for more details)

"Search for" - enter text, regular expressions, or XPath queries

"Replace with" - enter the text to use in the replace operation

Search panel contains options to modify the search:

  • Case sensitive options enables to select whether case sensitive matching should be used when searching in plain text as well as regex mode.
  • Whole word option will limit matches to whole words.
  • Multiline option allows to match multiple lines in the search pattern. When enabled with regex mode, Multiline option will be used in regular expressions engine.
  • Match dot as newline option is the "Singleline" option in .net regular expressions. When set, a dot (.) will match any character including new line.
  • Boolean operators option will combine multiple search patterns for Regex and Text searches.
  • Capture group search option allows using part of the file name in the search pattern.

Tip: if you leave the "Search for" field empty, dnGrep will find and list all the files that match the file filter criteria.
There is an option to enable/disable this feature.

Search Results

The "Search" button starts search process. Search can be paused or stopped at any time by clicking on "Pause" or "Cancel" buttons.

Once a search has been run, a "Search in results" check box becomes available to limit the next search to just the current result files.
The "Replace" button starts the replace process (see Search/Replace section for more details).
The "Undo" menu item can be used once replace is complete to rollback any changes (see Undo section for more details).

The results are shown in a tree - expand the file node to see the results.
The results contain lines with matches and a configurable number of context lines shown in gray text.
The line numbers are shown on the left, and breaks in the line numbering are separated with a horizontal line.

The F3 and Shift+F3 keys will move to the next match and first match in the next file in the results. The F4 and Shift+F4 keys move to the previous match and the last match in the previous file in the results.

If the "Preview file" option is enabled, selecting a file or line from a file will open the file in the Preview Window.

Once a search is complete, sort the results using the "Sort" button.
The split "Sort" button provides several options for sorting the results.

The "More" button contains a number of additional actions including "Copy files", "Move files", "Delete files", "File names to clipboard", and "Save results" (see Custom Actions section for more details).

Below the results panel there is an expandable panel to customize the results.
Click the expander button to hide or show the panel. Options include:

  • Highlight matches - enable or disable highlighting the match text background.
  • Highlight groups - if a regular expression contains capture groups, This option will be highlight the groups.
  • Show context lines - enable or disable showing extra lines before and after the matched line. Changes to this option will be applied in the next search.
  • Zoom - adjust the text size in the results panel.

The status bar at the bottom of the window indicates search/replace progress as well as the number of files matched and the time it took to perform the search/replace. IF there were problems reading files (permissions, locks, or errors) while searching the files the exclamation icon is shown.