Wow! Ok. the first seems clear enough, but a little tedious for the
number of lines I have (it's delimited text, so I could always note
the line number, %, note the line number, then use that search).

The latter seems like dark magic. I'll meditate upon it while
consulting the book of :help

Thanks for the super speedy reply!
Afton.



On 3/2/07, Tim Chase <[EMAIL PROTECTED]> wrote:
> How would I search for a regex within a particular area? The text
> document is very long, and I don't want to match all instances, just
> those I care about. I would probably select the text visually.


If you happen to know the line numbers of your interesting
section, you can use

        /\<200l\>100lregexp

which will search for "regexp" as long as it falls between line
100 and line 200 (exclusive).

Alternatively, you can use something like

:vnoremap g/
<c-c>/<bslash>%><c-r>=line("'<lt>")-1<cr>l<bslash>%<lt><c-r>=line("'>")+1<cr>l


(all in one line) will prime the search line with the search
line-limiting.  This makes it a bit easier so that within a
visually selected range, type "g/" and then type your search
regexp after the prepopulated line.

This works for line-wise visual mode.  Character-wise and
block-wise get a whole lot hairier.

Hope this gives you some ideas,

-tim





Reply via email to