Informationen wrote:

Hi,

how can I identify a single line no longer than e.g. 60 characters
preceded and followed by a blank line via regexs. This way I want to
identify section headings. What I did was mark every blank line with
%s/^$/>>>/ and than chomp the CR %s/\n//g and if the text
between the >>>'s isn't longer than 60 characters put it into
\section{}, and replace every >>> with \r\r. But in larger files
this takes a while. Is there a smarter solution to the problem?


The following regexp will do the match:

 ^\n\zs.\{1,60}\ze\n$

^ beginning of line
\n newline
\zs pattern really starts here (but must be precededed by the foregoing)
.\{1,60}   one to sixty characters
\ze pattern really ends here (but must be followed by the trailing pattern)
\n newline
$ end-of-line

Please read:   :help regexp  for (much) more.

Regards,
Chip Campbell

Reply via email to