Vim search and replace non-greedy

112 views Asked by At

I want to match all content non-greedily between words ABC and XYZ

ABC ....
...
... XYZ


ABC ...
...
...
...
XYZ

where ... represents any characters. The number of words and lines between ABC and XYZ may be 1 or more.

I tried using

:%s/ABC\(.*\)\n\(.*\n\)*\(.*\)XYZ//gc

The \(.*\n)* is making vim complain about memory usage.

How do i do this inside vim without looking to perl?

0

There are 0 answers