title: Help with back reference regex in Vim
body: <p>I am trying to write a regular expression in vi to match any whitespace character followed by any digit. Then, at each match, insert a dollar sign between the whitespace and the digit. Here is an example:</p>
  
  <pre><code>A1234 12 14 B1234
  B1256 A2 14 C1245
  C1234 34 D1 1234K
  </code></pre>
  
  <p>The correct regex would produce this:</p>
  
  <pre><code>A1234 $12 $14 B1234
  B1256 A2 14 C1245
  C1234 $34 D1 $1234K
  </code></pre>
  
  <p>I realize I need to use a back reference, but I can't quite seem to write the correct regex. Here is my attempt:</p>
  
  <pre><code>:'&lt;,'&gt;/(\s\d)/\s\1\$/g
  </code></pre>
  
  <p>Also, I have Vim's default regex mode turned off (<code>vnoremap / /\v</code>).</p>
  
  <p>Thanks for the help.</p>