regex

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

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

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
76 /100 Good
Development Activity 76
Maintenance 48
Community 80
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
91 /100 Excellent
Architecture 92
Code Quality 95
Innovation 90
Learning Curve 88

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 64 apps in this directory

Rust
89%
Apache 2.0

OpenFang

AI Agents

18,221

An open-source "Agent Operating System" built in Rust — a single binary providing a kernel, memory, skills, extensions, and multi-channel runtime for running AI agents, with 1,700+ tests and zero clippy warnings.

View details
51
Repo Health
73
Technical
67
Dependency
Built with
Rust 89%
Updated 4 months ago
Rust
91%
MIT

OpenPencil

AI Design Tools

6,464

An open-source, AI-native vector design tool with concurrent agent teams, design-as-code, a built-in MCP server, and multi-model intelligence — a distinct project from the similarly-named Figma-file-reading "open-pencil" editor.

View details
81
Repo Health
70
Technical
75
Dependency
Built with
Rust 91%
Updated 1 weeks ago
Python
73%
AGPL 3.0

OpenViking

AI Development · AI Memory · Databases

40,705

An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.

View details
85
Repo Health
75
Technical
64
Dependency
Built with
Python 73%
TypeScript 12%
Rust 11%
Updated 6 days ago
Rust
85%
AGPL 3.0

ParadeDB

Analytics · Databases · Search

9,436

Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.

View details
89
Repo Health
87
Technical
68
Dependency
Built with
Rust 85%
PLpgSQL 15%
Updated 6 days ago
Rust
76%
GPL 3.0

Pipedash

Developer Tools · Devops · Monitoring

1,103

One dashboard to monitor, trigger, and cancel CI/CD pipelines across GitHub, GitLab, Jenkins, Tekton, Buildkite, ArgoCD, and Bitbucket — desktop, Docker, or iOS.

View details
80
Repo Health
64
Technical
73
Dependency
Built with
Rust 76%
TypeScript 24%
Updated 6 days ago
TypeScript
42%
MIT

Portpal

Developer Tools · Monitoring

525

A native desktop dashboard that shows every port your machine is listening on, kills the process blocking it in one click, and visualizes how your services are actually connected.

View details
29
Repo Health
44
Technical
78
Dependency
Built with
TypeScript 42%
Rust 24%
CSS 23%
Updated 6 months ago
Rust
63%
MIT

PostgresML

AI Development · Databases

6,823

Run ML training and LLM inference natively inside PostgreSQL with GPU acceleration — no data movement required.

View details
51
Repo Health
76
Technical
64
Dependency
Built with
Rust 63%
JavaScript 11%
Updated 1 years ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
Rust
90%
Apache 2.0

Qdrant

AI Development · Databases · Search

35,220

Open-source vector database and search engine built in Rust for production-grade AI applications — from semantic search to RAG pipelines and recommendation systems.

View details
92
Repo Health
87
Technical
62
Dependency
Built with
Rust 90%
Updated 1 weeks ago

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