title: encodeURIComponent in regex
body: <p>I have more DIVs like this:</p>
  
  <pre><code>&lt;span class="date"&gt;Fri November 9, 2012&lt;/span&gt;
  </code></pre>
  
  <p>All these are in a var.
  Example:</p>
  
  <pre><code>var = '
  ...&lt;span class="date"&gt;Fri November 9, 2012&lt;/span&gt;...
  ...&lt;span class="date"&gt;Fri November 9, 2012&lt;/span&gt;...
  ';
  </code></pre>
  
  <p>I try to replace each date with a image that contain this date.</p>
  
  <p>I have this line but this didn't works:</p>
  
  <pre><code>ver = ver.replace(/&lt;span class="date"&gt;(.*)&lt;\/span&gt;/g,'&lt;span class="date"&gt;&lt;img src="generateLink.php?nr='+encodeURIComponent($1)+'" /&gt;&lt;/span&gt;');
  </code></pre>
  
  <p>My question is: I can't use <strong>encodeURIComponent</strong> in <strong>regex</strong>?</p>