How replace to same class names with foreach/each?
<p>I have to convert plain text urls to <code>&lt;a href=""&gt;&lt;/a&gt;</code>. I've found a JS code that works. My problem is that my HTML structure needs that I modify the code, putting the current code inside a foreach.</p>

<p>My html:</p>

<pre><code>&lt;div class="content"&gt;Some text with links&lt;/div&gt;
&lt;div class="content"&gt;Some text with links&lt;/div&gt;
&lt;div class="content"&gt;Some text with links&lt;/div&gt;
&lt;div class="content"&gt;Some text with links&lt;/div&gt;
&lt;div class="content"&gt;Some text with links&lt;/div&gt;
&lt;div class="content"&gt;Some text with links&lt;/div&gt;
</code></pre>

<p>The JS:</p>

<pre><code>$(function()
{
    var re = /(https?:\/\/(([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?))/ig;    
    $('.content').html($('.content').html().replace(re, '&lt;a href="$1" title=""&gt;$1&lt;/a&gt;'));
});
</code></pre>

<p>The above JS works, but will populate all the div's with the same content. I've tried to put this code in a foreach but have failed. My poor JS knowledge makes me ask this on SO.</p>

<p>Can you give some clues on how to put this code in a foreach loop?</p>
