Skip to main content

compile_pattern

Function compile_pattern 

Source
pub fn compile_pattern(pat: &str, case_insensitive: bool) -> Result<Regex>
Expand description

Compile a search pattern. case_insensitive adds the i flag; multi-line mode is on so ^/$ anchor to each line of a multi-line post body (the intuitive behavior for line-oriented content). Rust’s regex is linear-time, so user patterns cannot cause catastrophic backtracking / ReDoS.