Most of the other solutions offered here work on the ENTIRE line, which selects what might not be what you want.
To search and replace ONLY in the selection, first visually select the text, and then use the command:
:%s/\%VSEARCH/REPLACE/g
This will only search and replace in the visually selected section, replacing SEARCH with REPLACE. If you have selected more than one line, this will work on several lines as well.
Brad Parks Jul 09 '09 at 14:09 2009-07-09 14:09
source share