You can use the contents of any register on the ex or search command-lines with <C-R> followed by the register’s name. By yanking your visual selection, it is put into the 0 register, so <C-R>0 will add your yanked selection to the current command-line.
That is the only way I know of, but I still use it on a daily basis.