Skip to content

\K does not appear to work with --multiline #2528

Open
@jtojnar

Description

@jtojnar

What version of ripgrep are you using?

ripgrep 13.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)

How did you install ripgrep?

NixOS package.

What operating system are you using ripgrep on?

NixOS unstable

Describe your bug.

When I use PCRE 2 regex with \K in multiline mode, it will print the whole line instead only the part after \K.

What are the steps to reproduce the behaviour?

Run

printf "foo\nbar" | rg --multiline --pcre2 'foo\nb\K(a)'

What is the actual behaviour?

$ printf "foo\nbar" | rg --debug --multiline --pcre2 'foo\nb\K(a)'
DEBUG|globset|crates/globset/src/lib.rs:421: built glob set; 0 literals, 0 basenames, 12 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
DEBUG|globset|crates/globset/src/lib.rs:421: built glob set; 0 literals, 1 basenames, 0 extensions, 0 prefixes, 0 suffixes, 0 required extensions, 0 regexes
bar

What is the expected behavior?

It should print just ar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions