title: Use a register value as search pattern
body: <p>I wish to use the content of a register as search pattern in Vim. </p>
  
  <p>I would like to do this from the command line so I cannot use the <code>&lt;c-r&gt;</code> syntax since that assumes an interactive session.</p>
  
  <p>It is possible to use a register as a <em>replace</em> pattern, like this</p>
  
  <pre><code>:%s/foo/\=@a/g
  </code></pre>
  
  <p>However using this syntax as a <em>search</em> pattern does not work</p>
  
  <pre><code>:%s/\=@a/foo/g 
  </code></pre>
  
  <p>it outputs</p>
  
  <pre><code>E64: \= follows nothing
  E476: Invalid command
  </code></pre>