Question

I am trying to search ruby file and find all methods (before autoreplacing them later). In vim, i use following regexp:

/\vdef.*(\n.*){-}end

However even though i use "{-}", it selects whole file's contents.

Was it helpful?

Solution

uses \_. to include the newline character to the common ..

/\vdef\_.{-}end

OTHER TIPS

In my version of Vim, you need to escape the {, as well as using \_. as other answers have said:

/def\_.\{-}end

Try following regex.

/\vdef(\n|.){-}end

.* was culprit in your case

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top