On 23 Oct 2008, at 21:28, HappyDad wrote:
>
> Hello everyone,
> I would like to search and highlight a section of text in a mail log
> file. I'm looking for sections that begin with
>
> ...timesheet...
> ...(a few lines of text)...
> ...Winsock...
>
> i.e. search through the text file until you hit the text "timesheet",
> then highlight until you hit the word Winsock.
> I'm thinking something like:
>
> /timesheet.*Winsock
>
> except it needs to be able to span multiple lines between the two.
> There is text before and after both the "timesheet" and the "Winsock"
> as well as a varying number of lines between them.
> Is there a way to do this?
>
Assumng that the words 'timesheet' and 'winsock' are in fact words (i.e.
surronde by delimiters such as space, comma etc) try something like
this:-
/\<timesheet\>\_.\{-}\<Winsock\>/
The angle brackets cause the search to only consider discrete words.
'\_.' matches anything, including end-of-lines, and '\{-\}' matchces as
few occurences as possible.
HTH
Regards, Andy
--
Andrew Long
andrew dot long at mac dot com
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---