1 unstable release

0.1.0 Apr 18, 2021

#6 in #fns

Download history 95/week @ 2025-08-18 38/week @ 2025-08-25 28/week @ 2025-09-01 157/week @ 2025-09-08 103/week @ 2025-09-15 78/week @ 2025-09-22 34/week @ 2025-09-29 92/week @ 2025-10-06 101/week @ 2025-10-13 87/week @ 2025-10-20 53/week @ 2025-10-27 117/week @ 2025-11-03 168/week @ 2025-11-10 132/week @ 2025-11-17

473 downloads per month

MIT/Apache

8KB
175 lines

const-regex

Proc macro to match regexes in const fns. The regex must be a string literal, but the bytes matched can be any value.

The macro expects an &[u8], but you can easily use str::as_bytes.

const fn this_crate(bytes: &[u8]) -> bool {
    const_regex::match_regex!("^(meta-)*regex matching", bytes)
}

assert!(this_crate(b"meta-meta-regex matching"));
assert!(!this_crate(b"a good idea"));

Dependencies

~4MB
~67K SLoC