{"id":"e7ba2accfac1c4f1","repo":"BurntSushi/ripgrep","slug":"err-consider-enabling-pcre2-with-the-pcre2-fl","errorCode":null,"errorMessage":"{err}\n\nConsider enabling PCRE2 with the --pcre2 flag, which can handle backreferences\nand look-around.","messagePattern":"(.+?)\n\nConsider enabling PCRE2 with the --pcre2 flag, which can handle backreferences\nand look-around\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/core/flags/hiargs.rs","lineNumber":384,"sourceCode":"    /// The builder can be used to turn a directory entry (from the `ignore`\n    /// crate) into something that can be searched.\n    pub(crate) fn haystack_builder(&self) -> HaystackBuilder {\n        let mut builder = HaystackBuilder::new();\n        builder.strip_dot_prefix(self.paths.has_implicit_path);\n        builder\n    }\n\n    /// Return the matcher that should be used for searching using the engine\n    /// choice made by the user.\n    ///\n    /// If there was a problem building the matcher (e.g., a syntax error),\n    /// then this returns an error.\n    pub(crate) fn matcher(&self) -> anyhow::Result<PatternMatcher> {\n        match self.engine {\n            EngineChoice::Default => match self.matcher_rust() {\n                Ok(m) => Ok(m),\n                Err(err) => {\n                    anyhow::bail!(suggest_other_engine(err.to_string()));\n                }\n            },\n            EngineChoice::PCRE2 => Ok(self.matcher_pcre2()?),\n            EngineChoice::Auto => {\n                let rust_err = match self.matcher_rust() {\n                    Ok(m) => return Ok(m),\n                    Err(err) => err,\n                };\n                log::debug!(\n                    \"error building Rust regex in hybrid mode:\\n{rust_err}\",\n                );\n\n                let pcre_err = match self.matcher_pcre2() {\n                    Ok(m) => return Ok(m),\n                    Err(err) => err,\n                };\n                let divider = \"~\".repeat(79);\n                anyhow::bail!(","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/BurntSushi/ripgrep/blob/3fce3b5bb0236da2df6d99672afb8a719642eca7/crates/core/flags/hiargs.rs#L366-L402","documentation":"Error \"{err}\n\nConsider enabling PCRE2 with the --pcre2 flag, which can handle backreferences\nand look-around.\" thrown in BurntSushi/ripgrep.","triggerScenarios":"Thrown at crates/core/flags/hiargs.rs:384 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable PCRE2 with the --pcre2 flag to use backreferences and look-around","Rewrite the pattern to avoid backreferences/look-around so the default regex engine can compile it"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"3fce3b5bb0236da2df6d99672afb8a719642eca7","analyzedAt":"2026-08-06T01:39:05.073Z","schemaVersion":2}