Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Regex
  3. regex

regex

Apache-2.0Rust1.0.0

A Rust regular expression library with guaranteed linear time matching using finite automata.

Visit WebsiteGitHubGitHub
4.0k stars519 forks0 contributors

What is regex?

regex is a regular expression library for Rust that provides fast, safe pattern matching with guaranteed linear time complexity. It implements regex searches using finite automata, ensuring predictable performance even with untrusted patterns. The library supports Unicode by default and offers both string and byte-oriented matching APIs.

Target Audience

Rust developers who need reliable and performant text processing, pattern matching, or data validation in their applications. It's particularly valuable for those processing untrusted input where predictable performance is critical.

Value Proposition

Developers choose regex for its strong performance guarantees, safety in handling untrusted patterns, and comprehensive feature set including Unicode support and multiple matching strategies. Its linear time complexity prevents catastrophic backtracking, making it more secure and predictable than many other regex engines.

Overview

An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

Use Cases

Best For

  • Validating and extracting structured data from text (e.g., dates, identifiers)
  • Implementing search functionality with complex pattern matching
  • Processing logs or text files with regular expressions
  • Building parsers or text processors in Rust
  • Matching multiple patterns simultaneously against large texts
  • Byte-level pattern matching on binary or non-UTF-8 data

Not Ideal For

  • Projects requiring look-around assertions or backreferences for complex pattern validation
  • Applications where regex patterns are dynamically generated and compiled frequently, due to high compilation overhead
  • Systems with extreme binary size constraints where even stripped-down regex features are too heavy
  • Use cases where simple string methods or lightweight parsers suffice for basic text manipulation

Pros & Cons

Pros

Linear Time Guarantee

All searches have worst-case O(m*n) complexity, preventing exponential blowup and ensuring predictable performance with untrusted inputs, as stated in the README.

Full Unicode Support

Unicode is enabled by default, with options to disable it for byte-oriented matching via regex::bytes::Regex, making it versatile for international text and binary data.

Efficient Multi-Pattern Matching

RegexSet allows matching multiple regular expressions in a single scan, optimizing performance for sets of patterns, as demonstrated in the usage examples.

Modular Internals

Exposes regex-automata for advanced customization, enabling fine-tuned control over matching engines beyond the simple main API.

Cons

Limited Syntax Support

Omits advanced features like look-around and backreferences to maintain performance guarantees, which can be a deal-breaker for users needing complex regex patterns from other engines.

Slow Compilation Times

Compiling a regex can take microseconds to milliseconds, making it inefficient for dynamic patterns that change often, as warned in the README's anti-pattern section.

Increased Complexity for Customization

Accessing advanced features requires diving into regex-automata, which has a steeper learning curve and more verbose API compared to the straightforward main crate.

Frequently Asked Questions

Quick Stats

Stars3,989
Forks519
Contributors0
Open Issues47
Last commit8 days ago
CreatedSince 2014

Tags

#parsing#dfa#automata#unicode#regex#regex-engine#regex-parser#regexp#regex-syntax#pattern-matching#text-processing#nfa#rust#regular-expressions#performance

Built With

R
Rust

Links & Resources

Website

Included in

Rust56.6kRegex360
Auto-fetched 6 hours ago

Related Projects

Python: rePython: re

The Python programming language

Stars73,874
Forks34,975
Last commit16 hours ago
Java: java.util.regexJava: java.util.regex

JDK main-line development https://openjdk.org/projects/jdk

Stars23,143
Forks6,384
Last commit6 hours ago
JavaScriptCore: RegExpJavaScriptCore: RegExp

Home of the WebKit project, the browser engine used by Safari, Mail, App Store and many other applications on macOS, iOS and Linux.

Stars10,021
Forks2,070
Last commit6 hours ago
ripgrep-allripgrep-all

rga: ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, etc.

Stars9,765
Forks216
Last commit4 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub