[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

multi line regex's in vi ...



is there a way to match a pattern over more then one line in vi (i normally
use vim)?

i'm html formatting text documents and what i'd like to do is replace
something like the below paragraphs:
______________________________________________________________________

the first line of text, this is really boring, blah lah blh why do i
care.  html formatting text is really boring and vi saves me.

the is a second line of text.
______________________________________________________________________

with something like this

______________________________________________________________________

<p> the first line of text, this is really boring, blah lah blh why do i
care.  html formatting text is really boring and vi saves me.

<p> the is a second line of text.
______________________________________________________________________

you can almost do this in vi with the command:

:%s/^$/\r<p> /

but it leaves the "<p> " on the line above (which of course works fine but
offends my sense of neatness).  is there a way to do multiline matching with
vi/m or am i stuck with what i have.  i would think that a command like the
below one could do it, but vi seems to be line based not document based.

:%s/^$^/\r<p> /

thanks.
adam.


Reply to: