pub fn compile_pattern(pattern: &str) -> Result<Regex, Error>
Compiles a pattern into a regex, using cache for performance.