regex

Rust's finite-automata regex engine with guaranteed linear-time matching and no catastrophic backtracking.

Library
Cargo
v1.13.1
4,011stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
83/100Excellent
Development Activity84
Maintenance68
Community80
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
91/100Excellent
Architecture92
Code Quality95
Innovation90
Learning Curve88

regex is the official Rust crate for searching text with regular expressions, maintained under the rust-lang organization by Andrew Gallant (BurntSushi). It compiles patterns into finite automata rather than using a traditional backtracking engine, which guarantees worst-case O(m*n) search time regardless of the input — a property most regex libraries in other languages cannot offer, since attacker-controlled patterns can otherwise cause exponential blowup (ReDoS).

The crate exposes a small, ergonomic surface (Regex, RegexSet, Captures, and byte-oriented variants under regex::bytes) while delegating the heavy lifting to two sibling crates in the same workspace: regex-syntax for parsing and regex-automata for constructing and running the actual matching engines (lazy DFA, one-pass DFA, bounded backtracker, and a pike VM, selected automatically based on the pattern). It is one of the most widely depended-upon crates in the Rust ecosystem, with nearly a billion cumulative downloads.

What You Get

  • A Regex type for &str searches and a regex::bytes::Regex type for arbitrary &[u8] searches, sharing an identical API surface
  • RegexSet for matching many patterns against a haystack in a single pass, reporting which patterns matched
  • Named and numbered capture groups via Captures, plus a captures_iter().map(|c| c.extract()) pattern for typed group extraction
  • A RegexBuilder for tuning case-insensitivity, verbose mode, Unicode mode, size limits, and other compile-time options
  • Granular Cargo features to trim binary size and compile time by disabling Unicode tables or specific performance engines

Common Use Cases

  • Validating and extracting structured fields (dates, IDs, log line formats) from user input or log files
  • Splitting or replacing text based on pattern matches, including capture-group-aware replacement templates
  • Searching untrusted or adversarial input safely, where a backtracking engine’s worst-case blowup would be a denial-of-service risk
  • Building higher-level text-processing and lexing tools on top of the lower-level regex-automata and regex-syntax crates

Under The Hood

Architecture — The regex crate (src/lib.rs, src/regex/{string,bytes}.rs, src/regexset/) is a thin, ergonomic wrapper around regex-automata’s meta::Regex, which is a workspace sibling crate vendored via a path dependency. Pattern text first goes through regex-syntax for parsing into an AST/HIR, after which regex-automata selects among several matching strategies at runtime — a lazy (hybrid) DFA, a fully compiled DFA, a one-pass DFA for simple capture patterns, and a bounded backtracker or pike VM as fallbacks — based on the pattern’s shape, so callers get near-optimal performance without choosing an engine themselves. Tech Stack — Pure Rust, edition 2021, MSRV 1.65. Core dependencies are regex-automata (0.4.x) and regex-syntax (0.8.x), both maintained in the same repo/workspace, plus optional aho-corasick and memchr for literal-matching optimizations gated behind the perf-literal feature. The crate is no_std-friendly at the alloc layer through regex-automata, though the top-level regex crate itself currently requires std. Code Quality — Testing is unusually extensive for a crate of any ecosystem: a dedicated regex-test crate plus testdata/ (25 TOML fixture files) drive parameterized conformance suites (tests/suite_string.rs, suite_bytes.rs, suite_string_set.rs, suite_bytes_set.rs) across both the &str and &[u8] APIs, supplemented by regression.rs/regression_fuzz.rs for previously-found bugs and an in-repo fuzz/ target. CI (.github/workflows/ci.yml) runs across multiple Rust versions and feature-flag combinations. API Design — The public API is deliberately small: Regex::new, is_match, find/find_iter, captures/captures_iter, mirrored identically between the &str and regex::bytes modules, so switching between text and byte-oriented matching requires no relearning. Documentation is exceptionally thorough, with runnable doctests embedded directly in src/lib.rs’s 1,300+ line module doc covering syntax, Unicode behavior, performance guidance, and untrusted-input handling.

Used by 49 apps in this directory

Rust
64%
Apache 2.0

agentgateway

AI Development · Developer Tools

4,420

An open source AI-native proxy that secures, observes, and governs agent-to-LLM, agent-to-tool, and agent-to-agent communication through MCP, A2A, and unified LLM routing.

View details
88
Repo Health
82
Technical
72
Dependency
Built with
Rust64%
Go24%
Updated yesterday
TypeScript
51%
MIT

Anarlog

Note Taking · AI Assistants · Productivity

9,087

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
69
Dependency
Built with
TypeScript51%
Rust38%
Updated today
Dart
74%
AGPL 3.0

AppFlowy

Productivity · Project Management · Collaboration

75,729

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
66
Dependency
Built with
Dart74%
Rust24%
Updated 1 weeks ago
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
TypeScript
55%
Other

Cap

Team Chat · Video Conferencing

20,986

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
65
Dependency
Built with
TypeScript55%
Rust40%
Updated yesterday
Rust
95%
MIT

claw-code

AI Agents · AI Code Assistants

195,087

A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.

View details
71
Repo Health
71
Technical
77
Dependency
Built with
Rust95%
Updated 3 days ago
C
89%
MIT

codegraph

Developer Tools · AI Code Assistants

67,011

A pre-indexed code knowledge graph that cuts AI tool calls by 58% and token costs by 16% — auto-syncing, 100% local, works with Claude Code, Cursor, Codex, and more.

View details
81
Repo Health
85
Technical
73
Dependency
Built with
C89%
Updated 1 weeks ago
Go
32%
Apache 2.0

CubeSandbox

Developer Tools · Security · AI Agents

11,247

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
83
Repo Health
88
Technical
63
Dependency
Built with
Go32%
Rust31%
C21%
Updated today
Rust
66%
Other

DefGuard

Security · Networking · Authentication

2,805

Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.

View details
85
Repo Health
82
Technical
77
Dependency
Built with
Rust66%
TypeScript32%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search