I often use vim /
search command to verify my regular expressions (just to see what it matches). After that i usually use the :%s
replace command, where i use that regexp from search as a string to be replaced, e.g. i first look for such string:
/TP-\(\d\{5\}\)-DD-\d\{3\}
It matches exactly what i want, so i do my replace:
:%s/TP-\(\d\{5\}\)-DD-\d\{3\}/\1/g
But i have to write again entire regexp here. Usually that regexp is much longer, that's why I'm looking for solution:
Is there any existing shortcut or vim script for pasting that search pattern directly into replace command?
P.S. I use vim in terminal (no gvim).