pub fn compile_with(pat: &str, mode: Option<Mode>) -> Result<Regex, Error>Expand description
compile under an optional explicit mode.
ยงExamples
use coding_tools::pattern::{compile_with, Mode};
// 'todo!(' promotes to an invalid-paren regex without a mode; pinned
// literal, it matches its own text.
let re = compile_with("todo!(\"x\")", Some(Mode::Literal)).unwrap();
assert!(re.is_match(" todo!(\"x\") , here"));