Vim positive lookbehind error?

Enter this into the file:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA Hello A Hello B 

And then do a search with / :

 \(Hello\n\)\@<=A 

In my version of Vim (7.4, included patches: 1-582) under A under Hello matches, as expected, B not, but also 446th A in the first line matches.

Some strange behavior is connected with this, if I make the line longer with a lot of A s, 632nd A highlighted. If I enter 16 spaces at the beginning of a line, the 447th and 632th characters in the line are matched.

My question is: does this affect anyone else, and is it really a mistake or is my search wrong?

+5
source share
1 answer

Yes, that seems like a mistake. I can play with Vim 7.4.608, but only with automatic default selection :set regexpengine=0 .

To avoid this problem, you can either change the global option or explicitly specify the engine inside the template:

 \%#=1\(Hello\n\)\@<=A \%#=2\(Hello\n\)\@<=A 

Please report this error to either the vim_dev mail list or its tracker .

+4
source

Source: https://habr.com/ru/post/1213255/


All Articles