# rust-lang/regex

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/rust-lang-regex).**

3,978 stars · 513 forks · Rust · Apache-2.0

## Links

- GitHub: https://github.com/rust-lang/regex
- Homepage: https://docs.rs/regex
- awesome-repositories: https://awesome-repositories.com/repository/rust-lang-regex.md

## Topics

`automata` `automaton` `dfa` `nfa` `regex` `regex-engine` `regex-parser` `regex-syntax` `regexp` `regular-expressions` `rust`

## Description

This is a Rust regular expression library that provides a finite automata engine for searching and matching text patterns. It functions as a Unicode-compliant text scanner designed to guarantee linear time execution on all inputs to prevent catastrophic backtracking.

The engine supports both single and multi-pattern search capabilities, allowing it to scan a piece of text for multiple regular expressions simultaneously. It operates on both strings and raw byte slices to identify matching text segments.

The library covers text parsing, string validation, and pattern searching. It includes capabilities for regular expression syntax parsing and provides options for tuning engine performance to balance binary size, compilation time, and runtime execution speed.

## Tags

### Programming Languages & Runtimes

- [Finite Automata Regex Engines](https://awesome-repositories.com/f/programming-languages-runtimes/compiler-interpreter-internals/regular-expression-engines/finite-automata-regex-engines.md) — Provides a finite automata-based regular expression engine that guarantees linear time execution on all inputs.
- [Regular Expression Engines](https://awesome-repositories.com/f/programming-languages-runtimes/compiler-interpreter-internals/regular-expression-engines.md) — Implements regular expression matching and search using finite automata theory. ([source](https://cdn.jsdelivr.net/gh/rust-lang/regex@master/README.md))
- [NFA-Based Matching](https://awesome-repositories.com/f/programming-languages-runtimes/compiler-interpreter-internals/regular-expression-engines/finite-automata-regex-engines/nfa-based-matching.md) — Employs nondeterministic finite automata to guarantee linear time complexity and prevent catastrophic backtracking.
- [Regular Expression Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/regular-expression-libraries.md) — Ships a comprehensive regular expression library for Rust utilizing a finite automata engine.
- [Unicode Text Handling](https://awesome-repositories.com/f/programming-languages-runtimes/unicode-text-handling.md) — Supports full Unicode character processing and efficient scanning of multi-byte encoded strings.

### Data & Databases

- [Syntax Parsing & Analysis](https://awesome-repositories.com/f/data-databases/regular-expression-engines/syntax-parsing-analysis.md) — The engine deconstructs a regular expression into a syntax tree and intermediate representation to perform static analysis on the pattern. ([source](https://cdn.jsdelivr.net/gh/rust-lang/regex@master/README.md))
- [High-Performance Text Processing](https://awesome-repositories.com/f/data-databases/high-performance-text-processing.md) — Provides high-performance text extraction with guaranteed linear time complexity to prevent performance crashes.
- [Lazy State Compilation](https://awesome-repositories.com/f/data-databases/text-pattern-matching/dfa-based-scanning/lazy-state-compilation.md) — Builds the deterministic state machine incrementally during execution and caches results to balance memory use and speed.

### Development Tools & Productivity

- [Text Pattern Search](https://awesome-repositories.com/f/development-tools-productivity/text-pattern-search.md) — Enables high-performance searching for character or byte sequences within large strings.

### Software Engineering & Architecture

- [Aho-Corasick Implementations](https://awesome-repositories.com/f/software-engineering-architecture/string-matching-algorithms/aho-corasick-implementations.md) — Implements a specialized Aho-Corasick automaton to efficiently locate multiple patterns in a single text pass.
- [Multi-Pattern Matching Algorithms](https://awesome-repositories.com/f/software-engineering-architecture/string-matching-algorithms/multi-pattern-matching-algorithms.md) — Implements a system that can scan text for multiple regular expressions simultaneously in a single pass.
- [Byte-Slice Matching](https://awesome-repositories.com/f/software-engineering-architecture/string-validation-and-normalization/string-encodings/utf-8-internal-storage/utf-8-byte-operations/byte-slice-matching.md) — Provides the capability to search raw byte slices without the performance cost of UTF-8 validation.

### Web Development

- [String Pattern Validators](https://awesome-repositories.com/f/web-development/string-pattern-validators.md) — Allows verifying that text follows complex rules and formats using arbitrary regular expression patterns.
