Lets say that i have this text:
$test = \'lorem\'; $test2= \'ipsum\';
and I want to copy lorem and paste into ipsum. I tried to do yi\' on lor
yi\'
After you do ci' on impsum your lorem is in register "0. So, you can do ci'^R0 (^R means Ctrl+r) and paste your lorem in place of ipsum.
ci'
"0
ci'^R0
^R
Ctrl+r
See :help quote_number for more info on numbered registers.
:help quote_number