LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsnodeContextHubBackendgrep
Method●Since v1.10

grep

Copy
grep(
  pattern: string,
  path: string | null = null,
  glob: string | null = null,
  
View source on GitHub
maxCount
:
number
|
null
=
null
)
:
Promise
<
GrepResult
>

Parameters

NameTypeDescription
pattern*string
pathstring | null
Default:null
globstring | null
Default:null
maxCountnumber | null
Default:null

Search file contents for a literal text pattern.

Binary files (determined by MIME type) are skipped.

Literal text pattern to search for

Base path to search from (default: null)

Optional glob pattern to filter files (e.g., "*.py")

Optional cap on the total number of matches returned. When the cap is hit, results are flagged truncated: true.