MCPcopy Index your code
hub / github.com/abs0luty/pretty_regex

github.com/abs0luty/pretty_regex @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
63 symbols 78 edges 6 files 15 documented · 24%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

# 🔮 Write readable regular expressions

The crate provides a clean and readable way of writing your regex in the Rust programming language:

Without `pretty_regex` With `pretty_regex`
\d{5}(-\d{4})?
digit() * 5 + (just("-") + digit() * 4).optional()
^(?:\d){4}(?:(?:\-)(?:\d){2}){2}$
beginning() + digit() * 4
            + (just("-") + digit() * 2) * 2
            + ending()
rege(x(es)?|xps?)
just("rege") + (just("x") + just("es").optional())
             | (just("xp") + just("s").optional())

How to use the crate?

To convert a PrettyRegex into a regex from regex crate, you can call to_regex or to_regex_or_panic:

use pretty_regex::digit;

let regex = (digit() + ascii_alphabetic().optional()).to_regex_or_panic();

assert!(regex.is_match("3"));

Core symbols most depended-on inside this repo

just
called by 6
pretty_regex/src/lib.rs
optional
called by 3
pretty_regex/src/lib.rs
to_regex
called by 2
pretty_regex/src/unicode.rs
to_regex
called by 2
pretty_regex/src/lib.rs
to_regex_or_panic
called by 2
pretty_regex/src/lib.rs
digit
called by 2
pretty_regex/src/lib.rs
one_of
called by 2
pretty_regex/src/lib.rs
not
called by 1
pretty_regex/src/logic.rs

Shape

Method 27
Function 26
Class 8
Enum 2

Languages

Rust100%

Modules by API surface

pretty_regex/src/lib.rs49 symbols
pretty_regex/src/logic.rs8 symbols
pretty_regex/src/unicode.rs4 symbols
pretty_regex/examples/zip_plus_4.rs1 symbols
pretty_regex/examples/regexp.rs1 symbols

For agents

$ claude mcp add pretty_regex \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact