title: Difference between $1 and $& in regular expressions
body: <p>I have stumbled upon <code>$&amp;</code> when I use regular expressions. If I use <code>$1</code> I get the same result as with <code>$&amp;</code>. What is special with <code>$&amp;</code>, <strong>and where is it documented</strong>?</p>
  
  <p>When I search for "regular expression +$&amp;" on duckduckgo or google I can't find any relevant matches.</p>
  
  <p>In the example below it is possible to use <code>$1</code> or <code>$&amp;</code>. What is special about $&amp;, and why does it exist?</p>
  
  <p>See a <a href="https://jsfiddle.net/x99Lfysn/" rel="noreferrer" title="try it in jsfiddle">fiddle</a> with the example</p>
  
  <pre><code>&lt;div id="quotes"&gt;
    &lt;ul&gt;
      &lt;li&gt;Поехали!
        &lt;ul&gt;
          &lt;li&gt;&lt;b&gt;Let's go!&lt;/b&gt;&lt;/li&gt;
          &lt;li&gt;Variant translations: &lt;b&gt;Let's ride!&lt;/b&gt;&lt;/li&gt;
          &lt;li&gt;&lt;b&gt;Let's drive!&lt;/b&gt;&lt;/li&gt;
          &lt;li&gt;&lt;b&gt;Off we go!&lt;/b&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;i&gt;Облетев Землю в корабле-спутнике, я увидел, как прекрасна наша планета. Люди, будем хранить и преумножать эту красоту, а не разрушать её!&lt;/i&gt;
        &lt;ul&gt;
          &lt;li&gt;&lt;b&gt;Orbiting Earth in the spaceship, I saw how beautiful our planet is. People, let us preserve and increase this beauty, not destroy it!&lt;/b&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
      var quotes = document.getElementById("quotes"),
          html   = quotes.innerHTML,
          match  = /(let)/gi;
  
      // $1 gives same result
      quotes.innerHTML = html.replace(match, "&lt;mark&gt;$&amp;&lt;/mark&gt;");
  &lt;/script&gt;
  </code></pre>