Mini Regex Engine
  • Rust 83.8%
  • TypeScript 10.9%
  • HTML 2.7%
  • CSS 2.6%
Find a file
Lesley Lai 2c43aeb681
All checks were successful
/ test (push) Successful in 17s
setup forgejo CI
2026-02-16 17:11:24 +08:00
.forgejo/workflows setup forgejo CI 2026-02-16 17:11:24 +08:00
crates More efficient converter 2025-09-19 19:49:55 +10:00
.gitignore Initial commit 2025-08-25 15:18:49 +10:00
Cargo.lock wasm app 2025-09-01 23:14:56 +10:00
Cargo.toml Cargo workspace 2025-08-31 16:37:27 +10:00
LICENSE License 2025-08-31 00:28:08 +10:00
README.md add mirror links to readme 2026-02-11 18:21:16 +08:00

miniregex-rs

Mirrors: Codeberg | git.lesleylai.info

A simple non-backtracking NFA-based implementation of regular expressions.

It also contains a web app for visualizing the algorithm. See it alive at miniregex.lesleylai.info.

Features

  • Guarantees O(n * m) time complexity for matching (where n is the length of the input string and m is the length of the regex)
    • This prevents ReDoS vulnerabilities
  • A web-based visualizer for regex matching algorithm (thanks to WebAssembly)
  • UTF-8 characters support (thanks Rust)

Supported Syntax

Miniregex currently only supports a small subset of the syntax of regular expressions from you may see in other engines:

  • Repetitions: *, +, ?
  • Union: |
  • Grouping: (...)
  • Any Character: .
  • Escaped literal characters: e.g. \., \*, and \(
  • Bracketed Character Classes
    • ranges: e.g. [a-z]
    • union of multiple character classes: e.g. [a-zA-Z_]
    • Negated character classes: e.g. [^a-zA-Z]

All other characters are treated as literal characters.

Packages