🔮 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 + .optional
^(?:\d){4}(?:(?:\-)(?:\d){2}){2}$
beginning + digit * 4
+ * 2
+ ending
rege(x(es)?|xps?)
just +
|
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 digit;
let regex = .to_regex_or_panic;
assert!;