Skip to main content

regex_lazy

Macro regex_lazy 

Source
macro_rules! regex_lazy {
    ($pattern:expr) => { ... };
}
Expand description

Macro for defining a lazily-initialized, cached regex pattern.

Use this for ad-hoc regexes that are not already defined in this module.

§Panics

This macro will panic at initialization if the regex pattern is invalid. This is intentional for compile-time constant patterns - we want to catch invalid patterns during development, not at runtime.

§Example

use rumdl_lib::regex_lazy;
let my_re = regex_lazy!(r"^foo.*bar$");
assert!(my_re.is_match("foobar"));