In search expressions I know I can find the shortest match on line with the following expression:


So for example, if the text is like this:

begin end1 end2 end3

Then it will match up to the "1". However, what if the text is spread over multiple lines like this:

begin blah blah blah
blah blah blah end1 end2 end3

How do I do the same match across the end of line?

1 Answer 1


try /begin\_.\{-}end

\_. Matches any single character or end-of-line.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.