verify_regex!() { /* proc-macro */ }
Expand description
Compiles the given regex using the fancy_regex
crate and tries to match the given value. If
the value matches the regex, the macro will expand to the first expression. Otherwise it will
expand to the second expression.
It is designed to be used within other macros to produce compile time errors when the regex doesn’t match but it might work for other use-cases as well.
libcnb_proc_macros::verify_regex!(
"^A-Z+$",
"foobar",
println!("It did match!"),
println!("It did not match!")
);