The grep_search tool is designed for fast, exact regex searches using the ripgrep engine. It is preferred over semantic search when you know the exact symbol, function name, or text pattern you are looking for within specific directories or file types.
Key Constraints and Behaviors
- Match Type: Performs only exact regex searches. Do NOT attempt fuzzy or semantic matches.
- Output Limit: Results are capped at 50 matches to prevent overwhelming the output.
- Filtering: Use
include or exclude patterns to filter the search scope by file type or specific paths. - Input Requirement: You must return only a valid regex pattern string.
Regex Escaping Requirements
When providing a search string, you must escape special regex characters using a backslash (\). The characters that require escaping include:
(, ), [, ], {, }, +, *, ?, ^, $, |, ., and \.
| Literal | Regex Pattern |
|-----------------------|--------------------------|
| function( | function\\( |
| value[index] | value\\[index\\] |
| file.txt | file\\.txt |
| user\|admin | user\\\|admin |
| path\\to\\file | path\\\\to\\\\file |
| hello world | hello world |
| foo\\(bar\\) | foo\\\\(bar\\\\) |