Closed
Description
The regex
documentation suggests that flags ((?foo)
) only apply within the 'current group', which would match the behaviour of Perl and PCRE, but that doesn't seem to be the case:
# With PCRE
% printf '%s\n' foo Foo bar Bar | \rg -sP '((?i)foo)|Bar'
foo
Foo
Bar
# With Rust regex
% printf '%s\n' foo Foo bar Bar | \rg -s '((?i)foo)|Bar'
foo
Foo
bar # ???
Bar
(My test case uses ripgrep 11.0.2 from Homebrew, but i've confirmed that it works the same way if i compile a simple test app with regex
1.3.3.)
Am i misunderstanding something, or is this wrong?