Enter this in a file:
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Hello
A
Hello
B
And then search for this using /
:
\(Hello\n\)\@<=A
On my version of Vim (7.4, included patches: 1-582), the A
underneath Hello
is matched as expected, B
is not, but also the 446th A
on the first line is matched.
There is also some weird behaviour with this, if I make the line longer with more A
s, the 632nd A
is highlighted. If I introduce 16 spaces at the beginning of the line, the 447th and the 632nd characters on the line are matched.
My question is, does this affect anyone else, and is it really a bug or is my search erroneous?
Yes, this looks like a bug. I can reproduce with Vim 7.4.608, but only with the default :set regexpengine=0
automatic selection.
To avoid the problem, you can either change the global option, or explicitly specify an engine inside the pattern:
\%#=1\(Hello\n\)\@<=A
\%#=2\(Hello\n\)\@<=A
Please report this bug, either to the vim_dev mailing list, or its issue tracker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With