Peng Yu wrote:

Hi,

I have the following file segments. I want to concatenate all the
lines with their next lines, except that it ends with "}}". I want to
use the pattern "\(}}\)[EMAIL PROTECTED]". It seems not working.

Would you please help me to figure out how to match the lineend without "}}"?

This problem is one that LogiPat can help with!

 (see http://vim.sourceforge.net/scripts/script.php?script_id=1290
or http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs, see "LogiPat")

First, let's construct a pattern that matches all lines that don't end with }}:

:echo LogiPat('!"}}$"')

^\%(\%(}}$\)[EMAIL PROTECTED])*$

Now, that has a bit more than is necessary, but it does work. I'm not sure what you want with that trailing '^' -- was that supposed to mean beginning-of-line?
It isn't necessary if that's the case.

So, to do what you ask with LogiPat's result:

:g/^\%(\%(}}$\)[EMAIL PROTECTED])*$/j

Regards,
Chip Campbell



Reply via email to