Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
ripgrep 13.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
How did you install ripgrep?
APT
What operating system are you using ripgrep on?
Kubuntu 23.10
Describe your bug.
This is similar to #2420, and I understand why that's WONTFIX. This is different though.
Using a multiline regexp, when the regexp matches strings that come immediately one after another, it bungles the line numbers of all of them. Easier to show you with a reproduction example:
What are the steps to reproduce the behavior?
Save a file test.txt containing:
:properties:
:id: fnord
:end:
:properties:
:id: boccob
:end:
:properties:
:id: d321fdddffff
:end:
:properties:
:id: clowns
:end:
Then run
rg -nU '^:properties:\n:id: (.*)\n:end:' -r '$1' test.txt
What is the actual behavior?
The result is
1:fnord
2:boccob
3:d321fdddffff
4:clowns
Only the first hit is correct.
You can see that the line numbers will be correctly reported if you modify the file to add a newline after each instance of ":end:".
What is the expected behavior?
Expected the result:
1:fnord
4:boccob
7:d321fdddffff
10:clowns
Please tick this box to confirm you have reviewed the above.
What version of ripgrep are you using?
ripgrep 13.0.0
-SIMD -AVX (compiled)
+SIMD +AVX (runtime)
How did you install ripgrep?
APT
What operating system are you using ripgrep on?
Kubuntu 23.10
Describe your bug.
This is similar to #2420, and I understand why that's WONTFIX. This is different though.
Using a multiline regexp, when the regexp matches strings that come immediately one after another, it bungles the line numbers of all of them. Easier to show you with a reproduction example:
What are the steps to reproduce the behavior?
Save a file
test.txtcontaining:Then run
What is the actual behavior?
The result is
Only the first hit is correct.
You can see that the line numbers will be correctly reported if you modify the file to add a newline after each instance of ":end:".
What is the expected behavior?
Expected the result: