Macro lazy_regex::regex

source ยท
regex!() { /* proc-macro */ }
Expand description

Return a lazy static Regex checked at compilation time and built at first use.

Flags can be specified as suffix:

let case_insensitive_regex = regex!("^ab+$"i);

The macro returns a reference to a [regex::Regex] or a [regex::bytes::Regex] instance, differentiated by the B flag:

let verbose = regex!(r#"_([\d\.]+)"#)
    .replace("This is lazy-regex_2.2", " (version $1)");
assert_eq!(verbose, "This is lazy-regex (version 2.2)");