On Sat, 29 Apr 2006, Vim Visual wrote:
[snip]
I solved it like this:
:1,/received/d
:$?^\s*For subscribe options?,$d
:let @a=''
:g/hole\|relativistic\|LISA\|black\|supermassive\|intermediate/?^\s*astro-ph?,/^\s*astro-ph/-y
A
:%d
:put a
:1d
:%s!^\s*astro-ph/\(\d\+\)!<a href="http://xxx.lanl.gov/pdf/astro-ph/\1">&</a>
:w! /tmp/2.html
:q
and using the
cat /tmp/1.html | vim -s foo_arXiv.vim -
[snip]
For what it's worth, here's a search regex that will search for words in
blocks delimited by #begin# and #end# on its own line:
(all on one line)
/^#begin#\%(
\%(\n\(#end#\_$\)[EMAIL PROTECTED])*<word0>
\&\%([EMAIL PROTECTED])*<word1>
\&\%([EMAIL PROTECTED])*<word2>
\)\_.\{-}\_^\1$
For example, if
<word0> = foo
<word1> = bar
<word2> = xxx
then the regex will match
==
#begin#
On one foofine day, a regex
found itself in the local
bar... There were many
regexxxes there to
begin
and
end
with.
#end#
==
You can add on as many words as you need according to the \& format
above. After you are satisfied with the search, you can do something
like
:let @a = ''
:g//.,/#end#/y A
to yank all the blocks.
There was also discussion on this mailing list earlier (between Yakov
and I) on how to search for words in a paragraph. Assuming a paragraph
is delimited by blank lines ^\s*$, we have this search regex instead:
(all on one line)
/^\s*\%(
\%(\n\%(\s*\_$\)[EMAIL PROTECTED])*<word0>
\&\%(\n\%(\s*\_$\)[EMAIL PROTECTED])*<word1>
\&\%(\n\%(\s*\_$\)[EMAIL PROTECTED])*<word2>
\)\_.\{-}\ze\_^\s*$
HTH :)
--
Gerald