title: Add html attribute to string with javascript replace (regexp)
body: <p>i need to add a <strong>ng-click</strong> attribute to a IMG tag present in a string, using String.replace.</p>
  
  <p>Example:</p>
  
  <pre class="lang-js prettyprint-override"><code>&lt;p&gt;Test1&lt;/p&gt;
  &lt;p&gt;
    &lt;img class="fr-dib fr-draggable" src="http://admin.fsn.dev/uploads/a4cafaf13aabb97b041a50ae55c7bb6d331a7cc4.jpg"&gt;
    Foto1
  &lt;/p&gt;
  &lt;p&gt;
    &lt;img class="fr-dib fr-draggable" src="http://admin.fsn.dev/uploads/c5a7fc84d8f552d208e5ee0e0cbcecc0d547b441.jpg" style="width: 300px;"&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>Needs to be converted to:</p>
  
  <pre><code>&lt;p&gt;Test1&lt;/p&gt;
  &lt;p&gt;
    &lt;img class="fr-dib fr-draggable" src="http://admin.fsn.dev/uploads/a4cafaf13aabb97b041a50ae55c7bb6d331a7cc4.jpg" ng-click="openModal('http://admin.fsn.dev/uploads/a4cafaf13aabb97b041a50ae55c7bb6d331a7cc4.jpg')"&gt;
    Foto1
  &lt;/p&gt;
  &lt;p&gt;
    &lt;img class="fr-dib fr-draggable" src="http://admin.fsn.dev/uploads/c5a7fc84d8f552d208e5ee0e0cbcecc0d547b441.jpg" ng-click="openModal('http://admin.fsn.dev/uploads/c5a7fc84d8f552d208e5ee0e0cbcecc0d547b441.jpg')" style="width: 300px;"&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>Any suggestion?</p>
  
  <p>I tried with this but no luck :(</p>
  
  <pre class="lang-js prettyprint-override"><code>data = data.replace(/&lt;img(.*)src="(.*)"(.*)&gt;/ig,'&lt;img $1 src="$2" ng-click="openModal(\'$2\')" $3')
  </code></pre>