title: Javascript regular expressions: substituting variables
body: <p>I need a hand to sub a variable into a regular expression</p>
  
  <p>this line works fine:</p>
  
  <pre><code>subject = subject.replace(/&lt;a title="Smile"&gt;&lt;img.+?&lt;\/a&gt;/g, emoticons[1]);
  </code></pre>
  
  <p>I need switch the word "Smile" for a variable.</p>
  
  <p>I have tried a few different configurations like:</p>
  
  <pre><code>subject = subject.replace(/&lt;a title="'+emoLanguage[0]+'"&gt;&lt;img.+?&lt;\/a&gt;/g, emoticons[1]);
  </code></pre>
  
  <p>but I can't get the variable to work.</p>
  
  <p>Whats the trick??</p>