I want to align a rectangular region in Vim with regex, for example:
abcd test1 abcd test2
I want to combine test1 and test2 once, but not abcd s. ( test1 and test2 are constant, we do not need to consider [0-9] , which is just an example)
I want to match each column-aligned test1 test2
it
test1 test2
the rectangle area can appear anywhere, I canโt guess it in column โ3โ or something like that.
If they are not aligned, do not match.
I tried \1\@<=test1\n\(.*\)\@<=test2 , but no luck, because lookahead splits the group. (from :help \\@<= )
Does anyone know how to do this only with vim-regex? Thanks.
Edit:
The most complex example may be in this case:
aaaaaaaaa b test1 b c test2 c ddddddddd
matches only test1 and test2 .
You can use two or more regular expressions (one for test1 and one for test2 ?)
Edit2:
Itโs just for fun, Iโm just wondering how much vim can achieve, itโs not a serious problem, it can be boring and pointless for many people, and itโs good for me, please donโt worry, good night :)