for example you did
/foo
then you could:
%s
vim will replace all foo (your last search) with bar
Your last search pattern was saved in the / register, you can get it by reading the register value. eg.
"/p (in normal mode)
or
<cr>/ (in insert/command mode)
source share