Friday, May 28, 2010

Regex matching the first occurrence of a string

I want to match everything between and including Begin and End. There are
several blocks in the file:

Begin
ssss
dfsdfsdf
sdfsdf
End

Begin
sasdfsa
sdfgsd
hghfgh
End

My best guess so far:
:%s/Begin\_.*\(End\)\{-1}/This was one block/
Doesn't work

What am I missing?
Thanks.
--
View this message in context: http://old.nabble.com/Regex-matching-the-first-occurrence-of-a-string-tp28712875p28712875.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment