Regular expression for maximum digits excluding comma
<p>I have the below regular expression:</p>

<pre><code>ValidationExpression="[0-9]+(,[0-9]+)*"
</code></pre>

<p>It allows numbers in the format: 12,2345 or 231,23454</p>

<p>Now I want to include a condition that will on the whole allow only 7 digits max excluding 
comma. 
<strong>The below is the modified code</strong></p>

<p>The below is in the item template</p>

<p>I also have a radio button in item template</p>

<pre><code>&lt;asp:TextBox runat="server" ID="tbText" CssClass="someclass" MaxLength="11"
                                          %&gt;'&gt;&lt;/asp:TextBox&gt;

&lt;asp:RegularExpressionValidator ValidationExpression="[0-9]+(,[0-9]+)*" ID="ValComp" runat="server" CssClass="asdf"
    ControlToValidate="tbMileage" Text="*" Enabled="false" Display="Dynamic"/&gt;

&lt;asp:CustomValidator ID="cvalMileage" runat="server" CssClass="adsf" Text="*" Display="Dynamic"&gt;
&lt;/asp:CustomValidator&gt;

&lt;asp:CustomValidator ID="CustomValidator1" ClientValidationFunction="functionName" 
    runat="server" CssClass="asd" Text="*" Display="Dynamic"&gt;
&lt;/asp:CustomValidator&gt;
</code></pre>

<p>Since I want to validate the radio button checked corresponding textbox in repeater the below is the code I have written</p>

<pre><code>var selText = $(".Class1 input[type=radio]:checked").closest(".Class1").find(".subClassText input[type=text]").val();
alert('Hi');
if (selText.replace(",", "").length &lt;= 7) {
    args.IsValid = true;
}
else {
    args.IsValid = false;
}
</code></pre>

<p>The alert fires twice and based on args is False i have a popup that is firing twice</p>

<p>Thanks.</p>
