How to properly vim-escape a variable/register

I don't think there is such a list. Here is the escape function I have used for quite a while as part of a macro to search for the currently-selected string:

escape(@", '\\/.*$^~[]')

Edit:

Original answer had extra arguments due to my copying too much from my ~/.vimrc. Here is the mapping in which I used that escape in case having that context may help. Highlighting some text and typing * searches for the next occurrence of that text. (Mapping originally written by Jürgen Krämer.)


vnoremap <silent> * :<C-U>
          \let old_reg=getreg('"')<bar>
          \let old_regmode=getregtype('"')<cr>
          \gvy/<C-R><C-R>=substitute(
          \escape(@", '\\/.*$^~[]'), '\n', '\\n', 'g')<cr><cr>
          \:call setreg('"', old_reg, old_regmode)<cr>