pub fn build_regex(pattern: &str, flags: &str) -> Result<Regex, FunctionError>
Helper to build a Regex from pattern and flags