jquery exec() function
<p>I have the following </p>

<pre><code>$().ready(function() {
    $("input[name^=totalRent_]").each(function()
    {    var input = $(this);  
         var name = input.attr('name');  
         var num = /\d+$/.exec(name)[0];
</code></pre>

<p>My html form has:</p>

<pre><code>    &lt;input type="text" name="totalRent_1"  value="" /&gt; &lt;br /&gt;
    &lt;input type="hidden" name="totalRent_1_hidden" /&gt;&lt;br /&gt;
    &lt;hr /&gt;
    &lt;input type="text" name="totalRent_2"  value="" /&gt; &lt;br /&gt;
    &lt;input type="hidden" name="totalRent_2_hidden" /&gt;&lt;br /&gt;
    &lt;hr /&gt;
    &lt;input type="text" name="totalRent_3"  value="" /&gt; &lt;br /&gt;
    &lt;input type="hidden" name="totalRent_3_hidden" /&gt;&lt;br /&gt;
    &lt;hr /&gt;
</code></pre>

<p>Now, I get a javascript error saying: 
/\d+$/.exec(name) is null</p>

<p>The each function is attached to ("input[name^=totalRent_]"). What do I need to do so that in's only attached to total_rent and not with totalRent_..._hidden ? </p>

<p>Thanks in advance. </p>
