Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. fancy-regex

fancy-regex

MITRust0.18.0

A Rust regex library with hybrid NFA/backtracking engine for advanced features like look-around and backreferences.

Visit WebsiteGitHubGitHub
604 stars47 forks0 contributors

What is fancy-regex?

fancy-regex is a Rust library for regular expressions that supports advanced features like look-around and backreferences through a hybrid implementation. It combines backtracking for these "fancy" features with delegation to a high-performance NFA engine (the Rust regex crate) for parts of expressions that don't require them, aiming to provide both rich functionality and good performance.

Target Audience

Rust developers needing advanced regex features (like look-around or backreferences) for tasks such as syntax highlighting, text processing, or compatibility with Oniguruma-based grammars, where purely NFA-based engines are insufficient.

Value Proposition

Developers choose fancy-regex because it uniquely offers advanced regex features in Rust without the exponential worst-case performance of pure backtracking engines, by intelligently delegating to the efficient regex crate where possible, and providing Oniguruma syntax compatibility for editor grammars.

Overview

Rust library for regular expressions using "fancy" features like look-around and backreferences. Has a mode which aims to be compatible with Oniguruma syntax.

Use Cases

Best For

  • Implementing syntax highlighting grammars that use Oniguruma-style regex features
  • Matching patterns with look-ahead or look-behind assertions in Rust applications
  • Handling regex patterns with backreferences for text processing tasks
  • Ensuring compatibility with TextMate/Sublime Text/Atom editor syntax definitions
  • Avoiding exponential blowup in regex matching while using advanced features
  • Building text editors or IDEs with advanced regex-based parsing in Rust

Not Ideal For

  • Security-critical applications where regex patterns are user-controlled and denial-of-service attacks are a concern
  • Projects requiring recursive backreferences or other incomplete features listed in the README
  • Use cases that only need basic regex matching without fancy features, where the standard regex crate is sufficient
  • Environments demanding strict worst-case performance guarantees for all regex patterns, such as high-availability servers

Pros & Cons

Pros

Advanced Feature Support

Supports look-around and backreferences, enabling complex patterns like those used in TextMate syntax definitions, as shown in the README's example of capturing Rust raw strings with r(#*)".*?"\1.

Hybrid Performance Engine

Delegates to the Rust regex crate for NFA-based matching where possible, minimizing backtracking and aiming for linear-time performance, as detailed in the theory section on bottom-up and top-down analysis.

Oniguruma Compatibility

Offers a mode compatible with Oniguruma syntax, making it suitable for porting editor grammars from Sublime Text or Atom, as mentioned in the philosophy for syntax highlighting.

Online Playground

Provides a web-based playground for testing and exploring regexes with advanced features, linked in the README for easy experimentation and debugging.

Cons

Missing Features

The README explicitly states that backreferences at recursion levels and optimizations are currently missing, limiting functionality for advanced or edge-case regex patterns.

Worst-Case Performance Risks

For regexes with fancy features, fancy-regex gives no guarantees against exponential blowup, posing a denial-of-service risk if patterns are attacker-controlled, as warned in the 'A warning about worst-case performance' section.

Development Status

Still in development with ongoing changes, which might lead to breaking updates or incomplete documentation compared to more mature libraries like the regex crate.

Open Source Alternative To

fancy-regex is an open-source alternative to the following products:

P
PCRE

A library of Perl-compatible regular expression functions for C and C++ programming languages, widely used for pattern matching.

O
Oniguruma

A regular expression library that provides pattern matching functionality for text processing in various programming languages.

Frequently Asked Questions

Quick Stats

Stars604
Forks47
Contributors0
Open Issues8
Last commit1 day ago
CreatedSince 2018

Tags

#regex#syntax-highlighting#text-processing#backtracking#rust-library#regular-expressions

Built With

R
Rust

Links & Resources

Website

Included in

Rust56.6k
Auto-fetched 1 day ago

Related Projects

ripgrep-allripgrep-all

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

Stars9,637
Forks213
Last commit2 months ago
KreuzbergKreuzberg

A polyglot document intelligence framework with a Rust core. Extract text, metadata, images, and structured information from PDFs, Office documents, images, and 97+ formats. Available for Rust, Python, Ruby, Java, Go, PHP, Elixir, C#, R, C, TypeScript (Node/Bun/Wasm/Deno)- or use via CLI, REST API, or MCP server.

Stars8,365
Forks490
Last commit1 day ago
grexgrex

A command-line tool and Rust library with Python bindings for generating regular expressions from user-provided test cases

Stars8,129
Forks193
Last commit2 months ago
MelodyMelody

Melody is a language that compiles to regular expressions and aims to be more readable and maintainable

Stars4,746
Forks58
Last commit1 year 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