This crate provides tools for compiling and using regular expressions.
It is intended as a simple but compiler-checked version of the regex crate, as it does regular expression compilation at compile-time, but only supports POSIX Extended Regular Expressions.
[!IMPORTANT] Work-in-progress
This project is not feature-complete. It currently supports regular expression
test, but does not yet fully implement capture groups. Additionally, it currently only has one engine implemented.
Usage
use *;
const PHONE_REGEX: Regex = compile_regex!;
To minimize memory overhead and binary size, it is recommended to create a single instance of each regular expression (using a const variable) rather than creating multiple.
Alternatives
ere is intended as an alternative to regex that provides compile-time checking and regex compilation. However, ere is less featureful, so here are a few reasons you might prefer regex:
- You require more complex regular expressions with features like backreferences and word boundary checking (which are unavailable in POSIX EREs).
- You need run-time-compiled regular expressions (such as when provided by the user).
- Your regular expression runs significantly more efficiently on a specific regex engine not currently available in
ere.