BurntSushi/ripgrep · error

{err} Consider enabling PCRE2 with the --pcre2 flag, which

Error message

{err}

Consider enabling PCRE2 with the --pcre2 flag, which can handle backreferences
and look-around.

What it means

Error "{err} Consider enabling PCRE2 with the --pcre2 flag, which can handle backreferences and look-around." thrown in BurntSushi/ripgrep.

Source

Thrown at crates/core/flags/hiargs.rs:384

    /// The builder can be used to turn a directory entry (from the `ignore`
    /// crate) into something that can be searched.
    pub(crate) fn haystack_builder(&self) -> HaystackBuilder {
        let mut builder = HaystackBuilder::new();
        builder.strip_dot_prefix(self.paths.has_implicit_path);
        builder
    }

    /// Return the matcher that should be used for searching using the engine
    /// choice made by the user.
    ///
    /// If there was a problem building the matcher (e.g., a syntax error),
    /// then this returns an error.
    pub(crate) fn matcher(&self) -> anyhow::Result<PatternMatcher> {
        match self.engine {
            EngineChoice::Default => match self.matcher_rust() {
                Ok(m) => Ok(m),
                Err(err) => {
                    anyhow::bail!(suggest_other_engine(err.to_string()));
                }
            },
            EngineChoice::PCRE2 => Ok(self.matcher_pcre2()?),
            EngineChoice::Auto => {
                let rust_err = match self.matcher_rust() {
                    Ok(m) => return Ok(m),
                    Err(err) => err,
                };
                log::debug!(
                    "error building Rust regex in hybrid mode:\n{rust_err}",
                );

                let pcre_err = match self.matcher_pcre2() {
                    Ok(m) => return Ok(m),
                    Err(err) => err,
                };
                let divider = "~".repeat(79);
                anyhow::bail!(

View on GitHub (pinned to 3fce3b5bb0)

Solutions

  1. Enable PCRE2 with the --pcre2 flag to use backreferences and look-around
  2. Rewrite the pattern to avoid backreferences/look-around so the default regex engine can compile it

When it happens

Trigger: Thrown at crates/core/flags/hiargs.rs:384 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BurntSushi/ripgrep@3fce3b5bb0 (2026-08-06). Data as JSON: /data/errors/e7ba2accfac1c4f1.json. Report an issue: GitHub.