LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Configuration
  • 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

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsConfigurationTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsindexSandboxBackendProtocolV2grep
Method●Since v1.8

grep

Search file contents for a literal text pattern.

Binary files (determined by MIME type) are skipped.

Copy
grep(
  pattern: string,
  path: string | null,
  glob: string | null
): MaybePromise<GrepResult>

Parameters

NameTypeDescription
pattern*string

Literal text pattern to search for

pathstring | null

Base path to search from (default: null)

globstring | null

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

View source on GitHub