| title | Usage Guide |
|---|---|
| layout | default |
This guide walks through the complete workflow for running searches, managing tabs, and taking advantage of Grex’s advanced capabilities.
- Open Grex and click Browse… to choose a folder, or paste a path into the AutoSuggestBox.
- The AutoSuggestBox auto-completes from your last 20 locations (Windows, UNC, and WSL paths are all supported).
- Examples:
- Windows:
C:\Users\You\source - UNC:
\\server\share\logs - WSL:
\\wsl$\Ubuntu\home\user\projector/mnt/c/Users/You/source
- Windows:
- Search Type dropdown: Text Search (default) or Regex Search.
- Results Mode dropdown: Content (per-line hits) or Files (aggregated by file).
- Switch at any time; Grex re-renders the view without re-running the search.
Click Filter Options in the CommandBar to expand the full set of toggles:
- Respect
.gitignore, include system files, include subfolders, include hidden items, include binary files, include symbolic links. - Filename filter (
Match Files) and directory exclusion (Exclude Dirs) inputs. - Size limit selector (No Limit, Less Than, Equal To, Greater Than) with KB/MB/GB units.
- Windows Search toggle (enabled automatically when the active path and search type qualify).
- String comparison defaults (comparison mode, Unicode normalization, diacritic sensitivity, culture) live under Settings → Filter Options if you want those defaults applied to new tabs.
Tip: Set default values for Match Files and Exclude Dirs in Settings → Filter Options. These defaults automatically populate new tabs, saving you from re-entering common patterns like *.cs;*.json or ^(.git|node_modules|vendor)$.
- Type your search text or Regex into the main input box.
- Optional: Enter replacement text underneath to enable the Replace workflow.
- Press Enter or click Search to execute.
- Content Mode shows filename, line, column, snippet, and relative path.
- Files Mode shows size, match count, extension, encoding, and timestamps.
- Status bar displays match count, file count, and elapsed time (formatted as seconds with milliseconds for fast searches, or minutes/hours for longer ones).
- Sort by clicking column headers, drag edges to resize, or right-click headers to hide/show columns (preferences persist per table).
- Double-click any row to open the file in your default editor.
Before diving into a file, you can quickly preview the surrounding lines of any match:
- Select a result in the Content Mode list.
- Press Space or right-click and choose Preview from the context menu.
- A dialog appears showing:
- The file name and line number at the top
- Context lines before and after the match (default 5, configurable in Settings → Context Preview)
- The matched line highlighted with a blue indicator bar
- Line numbers in a gutter for easy reference
- Open in Editor – Click this button to jump directly to the file at the matched line in your default editor.
- Close – Press Escape or click Close to dismiss the preview and continue searching.
Tip: Context Preview is especially useful when you have many matches and want to quickly assess each one without opening every file. Adjust the context line count (1-20) in Settings to show more or less surrounding code.
After a search completes, use the Search within results… box above the table to filter the current result set without re-running the scan:
- Content mode filters by file name, relative path, and matched line text.
- Files mode filters by file name, relative path, extension, and encoding.
- Regex mode – Click the
.*toggle button to use regular expressions for filtering. - Clearing the box restores the unfiltered results and the normal "Found …" status summary.
When you want semantic help instead of strict literal/Regex matching:
- Open Settings → AI Search and set:
- Endpoint (OpenAI-compatible base URL)
- API key (optional)
- Model (optional; leave blank for auto-detect via
/v1/models) - Click Test Endpoint to verify connectivity before starting chat.
- Return to Search and click the AI command in the command bar.
- Grex switches from result grids to an AI chat panel.
- The request includes:
- Your active search path
- Your current search query
- Search type and result mode
- Active filters as guidance suggestions
- Ask follow-up questions in the chat input to narrow where to inspect next.
Note: While AI mode is active, the standard results list and "Search within results" UI are intentionally hidden.
- Enter replacement text, click Replace, and review the confirmation dialog.
- Grex switches to Files mode so you can see exactly which files will change.
- The operation respects every filter (gitignore, binary toggle, etc.) that the search used.
- While a search is running, the Search button changes to Stop with a stop icon.
- While a replace is running, the Replace button changes to Stop with a stop icon.
- Click Stop at any time to immediately cancel the operation.
- Cancellation is graceful—no errors or partial state corruption.
- During a search, the Replace button is disabled; during a replace, the Search button is disabled to prevent conflicting operations.
After running a search, export your results for further analysis or sharing:
- Click the Export button in the command bar (enabled when results exist).
- Choose a format:
- CSV – Opens a file picker to save as comma-separated values, suitable for spreadsheets.
- JSON – Opens a file picker to save as pretty-printed JSON, ideal for programmatic processing.
- Copy to Clipboard – Copies tab-separated values directly to your clipboard for quick pasting.
- Save location – The file picker suggests a timestamped filename (e.g.,
grex_results_2024_01_15_14_30.csv).
Tip: Content mode exports include line numbers and content; Files mode exports include size, encoding, and timestamps.
Grex automatically tracks your recent searches for quick recall:
- Click the search history dropdown next to the search box.
- Select a recent search to restore the query, path, and all filter settings instantly.
- Remove entries – Hover over an entry and click the remove button to delete it.
- Clear all – Use the "Clear History" option to remove all entries.
Note: Up to 20 searches are stored in %LocalAppData%\Grex\search_history.json.
Search history is automatic and time-ordered; Search Profiles are named presets you save intentionally.
- Click Profiles in the command bar.
- Click Save Current…, enter a profile name, and confirm overwrite if prompted.
- Click a saved profile to apply it to the current tab (path, search term, results mode, and filter options).
- Use the delete button in the Profiles list to remove an unwanted profile.
Profiles are stored in %LocalAppData%\Grex\search_profiles.json.
- Click "+" to open a fresh search tab; each tab retains its own filters and results.
- Close tabs with the "×" button (at least one tab always stays open).
- Tab titles automatically abbreviate long paths so you can identify them at a glance.
- Click the Regex Builder icon in the navigation pane.
- Left column: sample text and pattern inputs with preset buttons (Email, Phone, Date, Digits, URL).
- Right column: live match preview plus a visual breakdown of your Regex syntax.
- Toggles for case-insensitive, multiline, and global matches let you experiment before running a real search.
- Open Settings to change application language, theme, default search type/results, filter defaults, Windows Search preference, and string comparison options.
- AI Search settings (endpoint, optional API key, optional model) are also stored here and reused by every tab.
- Use Test Endpoint in Settings → AI Search to validate endpoint/auth by calling
/v1/modelsand confirming the response. - Settings are saved instantly to
%LocalAppData%\Grex\settings.jsonand applied to all future tabs. - Theme changes (Light/Dark/System) update the entire UI, including the Mica backdrop on Windows 11.
The Backup & Restore section in Settings lets you preserve or transfer your configuration:
- Export Settings – Click to save a timestamped copy of your settings (e.g.,
settings_2024_01_15_14_30_45.json). Use a file picker to choose where to save it. - Import Settings – Click to browse for a previously exported JSON file. Grex validates the file and merges the settings into your current configuration. Some changes (like theme or language) may require a restart to take full effect.
- Restore Defaults – Click to delete your settings.json and restart the application with factory defaults. A confirmation dialog ensures you don't accidentally reset.
Note: Window position and size are excluded from imports since they are machine-specific.
- Find TODOs: search for
TODOwith Content mode. - Locate SSNs: Regex
\b\d{3}-\d{2}-\d{4}\bwith Content mode. - Scan Linux projects: search
\\wsl$\Ubuntu\home\user\repowhile respecting.gitignore. - Compare error casing: toggle Search case-sensitive and search
Error. - Narrow by size: set Size Limit → Less Than 10 MB to skip large binaries.
- Enable the toggle when searching Windows folders that are indexed (Documents, Desktop, etc.).
- Grex queries the index for candidate files, then still applies every filter and reads the files to confirm matches—so results remain accurate.
- Regex searches, WSL paths, and non-indexed locations automatically fall back to the custom file walker; no manual toggling required.
- Enable Docker Search – Open Settings → Docker Search and toggle "Enable Docker Search" once per machine. This preference is saved and applied to all new tabs.
- Select a Container – After enabling Docker search, each tab shows a "Search Target" dropdown beside the path field. The dropdown defaults to "Local Disk" for normal file system searches.
- Choose a Running Container – Select any running Docker container from the dropdown to search inside that container. The dropdown lists all currently running containers with their names and IDs.
- Refresh Container List – Click the refresh button (↻) next to the dropdown to update the list of running containers without restarting the application.
- Enter Container Path – When a container is selected, enter the path you want to search inside the container (e.g.,
/var/www/html,/app/src,/usr/local/bin). Grex automatically uses the most efficient search method available. - Search Methods – Grex uses two search strategies for Docker containers, automatically selecting the best one:
- Direct Grep (Preferred): Uses the Docker API to run
grepdirectly inside the container. This is significantly faster because it doesn't require copying files to the host. Grex automatically checks ifgrepis available in the container. - Mirror Fallback: If
grepis not available in the container (e.g., minimal Alpine images without coreutils), Grex falls back to mirroring the container path to a temporary local directory (%LocalAppData%\Grex\docker-mirrors) and searching the mirrored files.
- Direct Grep (Preferred): Uses the Docker API to run
- Search Behavior – When searching a container:
- Grex first attempts the direct grep method via the Docker API
- If grep is unavailable, it automatically falls back to the mirror approach
- Result paths are displayed as container paths regardless of which method was used
- The Browse button is automatically disabled to prevent mixing host and container paths
- Replace operations are disabled (container files are read-only from the host)
- Windows Search integration is automatically disabled (containers are not indexed by Windows)
- Symbolic Links – When the "Include symbolic links" option is unchecked (the default), Grex uses
tar --dereferenceto copy actual file contents instead of creating symlinks. This avoids Windows privilege issues with directories likenode_modulesthat contain many symlinks. - Context Menu – Right-clicking results in Docker mode shows container-specific options:
- Copy Container Path – Copies the container path (e.g.,
/var/www/html/file.txt) to the clipboard - Copy File Name – Copies just the filename to the clipboard
- These shortcuts make it easy to jump back into
docker execor your IDE with the correct container path
- Copy Container Path – Copies the container path (e.g.,
- Automatic Cleanup – Mirrored container paths are automatically cleaned up after searches complete. Old mirrors (older than 6 hours) are pruned automatically.
Note: Docker search requires Docker Desktop to be installed and running. The container dropdown will be disabled if Docker is not available. For the fastest searches, use containers that include grep (most Linux-based images do).
Performance: Docker searches use parallel grep execution (xargs -P 4) and grep availability caching for near-instant repeat searches. System paths (.git, vendor, node_modules, storage/framework, bin, obj) are filtered at the find level for maximum performance.
- Make sure WSL is installed and the
wslcommand works from PowerShell. - Use
\\wsl$\Distro\pathor/mnt/...paths; Grex converts them and shells out togrepwhen necessary. - Case-insensitive toggles translate to the
-iflag; other comparison settings are ignored becausegrephandles the matching.
- The Settings page includes Test Notification to verify Windows toast support and troubleshoot missing Windows App Runtime installations.
- If Grex launches elevated, it warns you because Windows notifications don't fire under admin privileges; re-open via
explorer.exefrom a non-elevated context for the best experience.
For script integration and automation, use the headless CLI (grex-cli):
# Basic search
grex-cli "C:\Projects" "TODO"
# Regex search with JSON output
grex-cli "C:\src" "TODO|FIXME" --regex --format json
# Count matches only
grex-cli "C:\docs" "error" --count
# Files with matches (like grep -l)
grex-cli "C:\code" "deprecated" --files-only
# Quiet mode for conditionals
grex-cli "C:\config" "secret" --quiet && echo "Found!"The CLI supports all search filters (--gitignore, --case-sensitive, --match-files, etc.) and outputs in text (grep-compatible), JSON, or CSV formats. See the Technical Reference for complete option documentation.
Keep this guide handy for day-to-day workflows. When you need implementation details or architectural context, see docs/architecture.md and docs/build-and-test.md.