>> :%s/\(\[\_p\{-}]\)\|\(\%^\|^\n\)\@<=\(\p\+\n\)\{-1,}\ze\(^\n\|\%$\)//n
>>
BTW, I tested both
:%s/\(\[\_p\{-}]\)\|\(\%^\|^\n\)\@<=\(\p\+\n\)\{-1,}\ze\(^\n\|\%$\)//n
and
:%s/\(\[\_p\{-}]\)//n
Both worked well for my file and returned the same number. Why do you
need all the or part, match start and end of file and look behind for
the actual match?
Also for paragraphs that are separated by one empty line the following
counted # of paragraphs:
%s/^\n\{1}//n
%s/^\n//n
%s/\(^\s*$\)//n
It works simply b/c there's one empty line per paragraph. I still
didn't figure how to match: possible empty line followed by one or
more lines of text followed by an empty line.
Cheers,
Yosi
--
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