title: Add variable into string
body: <p>All I need to do here is to add a variable before each specific string.</p>
  
  <p>Example:</p>
  
  <pre><code>var exampleString = "blabla:test abcde 123test:123";
  var formattedString = "el.blabla:test abcde el.123test:123";
  </code></pre>
  
  <p>As you can see, when I have something like "XXX:XXX", I need to add a variable before it.</p>
  
  <p>I have the Regex to find "XXX:"</p>
  
  <pre><code>var regex = new RegExp(/\w+([aA-zZ]:)/g)
  </code></pre>
  
  <p>But when I try to replace it, it replaces all instead of adding the variable "el."</p>
  
  <pre><code>var exampleString = "blabla:test abcde 123test:123";
  var formattedString = exampleString.replace(new RegExp(/\w+([aA-zZ]:)/g), 'el.');
  // formattedString is now "el.test abcde el.123"
  // Instead of "el.blabla:test abcde el.123test:123"
  </code></pre>
  
  <p>Could anyone makes this work ? Thanks :)</p>
  
  <p>Source: <a href="https://stackoverflow.com/questions/4029109/javascript-regex-how-to-put-a-variable-inside-a-regular-expression">Javascript Regex: How to put a variable inside a regular expression?</a></p>