GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - copyleftdev/pegrep: Text and structural search with readable PEG patterns, typed captures, and JSON output.

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents/skills
.agents/skills
 
 
.github/workflows
.github/workflows
 
 
crates
crates
 
 
docs
docs
 
 
examples
examples
 
 
plans
plans
 
 
schemas
schemas
 
 
scripts
scripts
 
 
state
state
 
 
tests
tests
 
 
vendor
vendor
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
LICENSE-APACHE
LICENSE-APACHE
 
 
LICENSE-MIT
LICENSE-MIT
 
 
PLANS.md
PLANS.md
 
 
README.md
README.md
 
 
START.md
START.md
 
 
requirements-design.txt
requirements-design.txt
 
 
rust-toolchain.toml
rust-toolchain.toml
 
 
skills.lock.json
skills.lock.json
 
 
sys.md
sys.md
 
 
user.md
user.md
 
 

Repository files navigation

PEGREP

Checks Platforms Release

Search text and nested structures with readable patterns, typed captures and JSON output. PEGREP chooses an execution strategy for each pattern while preserving its matching semantics.

# Find matching lines across a source tree.
pegrep -F TODO -n -g '*.rs' crates

# Extract only server-error status codes.
printf '200 404 500 503\n' | pegrep 'status:int where status >= 500' -o
# 500
# 503

# Capture a call's arguments, including nested calls and quoted parentheses.
printf '%s' 'call(a, f("x)"))' |
  pegrep '"call" args:balanced("(", ")", lex="strings")' --json

Install

Download an archive from GitHub Releases, extract it, and put pegrep (pegrep.exe on Windows) on your PATH. Each release includes SHA256SUMS.

Platform Archive suffix
Linux x86_64, glibc 2.39+ x86_64-unknown-linux-gnu.tar.gz
macOS 15+, Apple Silicon aarch64-apple-darwin.tar.gz
Windows x86_64 x86_64-pc-windows-msvc.zip

Or build from source with Rust 1.97.1 and a C toolchain:

git clone https://github.com/copyleftdev/pegrep.git
cd pegrep
cargo install --locked --path crates/pegrep-cli
pegrep --help

Build from the complete workspace: it includes the vendored Unicode and traversal patches. See installation and checksum verification.

What it does

  • Literal search with -F, regular expressions with --regex, and composable PEG patterns.
  • Typed captures, comparisons, JSON strings, balanced delimiters and reusable nonrecursive patterns.
  • Ignore-aware directory traversal, globs, context lines, counts, file lists and bounded parallel workers.
  • JSON Lines with byte spans and typed values; versioned pattern IR and explainable execution plans.
  • Explicit limits for memory, work, nesting and output; limit exhaustion reports an error.
pegrep --regex 'ERROR[0-9]+' -o application.log
printf 'answer=42\n' | pegrep 'key:identifier "=" value:int' --json
pegrep --explain '"ERROR" ws code:int'
pegrep -F TODO --count-matches -j 4 crates

Semantics that matter

PEG choice commits to the first successful alternative, and repetition does not backtrack. For example, ("a" | "ab") "c" does not match abc. Typed filters run after that choice commits.

Input defaults to strict UTF-8 with binary detection. --bytes accepts arbitrary bytes. JSON preserves invalid bytes using base64. Cross-file output order is unspecified unless you select --sort path or serial execution.

Exit codes: 0 matches, 1 no matches, 2 error, 130 interruption. Errors can follow partial output, so check the exit status. Resource reservations are not a total-process RSS ceiling, and cancellation is cooperative.

The v0.1 MVP includes balanced nesting, but not recursive user grammars, rewriting or language AST adapters. Performance depends on the pattern and workload; there is no universal speed advantage over ripgrep.

Documentation and development

User guide · Pattern language · JSON/output contract · Examples · Release process

python3 -m pip install -r requirements-design.txt
bash scripts/gates.sh design
bash scripts/gates.sh dev

CI checks formatting, lint, default/all-feature tests, documentation, pattern/output fixtures and native Linux/macOS/Windows behavior. Tagged releases run those checks before publishing native archives and checksums. The full release gate also checks fuzzing, equivalence, controlled performance and isolated installation.

License

MIT OR Apache-2.0, at your option. Vendored dependencies retain their own notices.

About

Text and structural search with readable PEG patterns, typed captures, and JSON output.

Topics

cligreppegrustsearchstructural-search

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.