Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Frineds,

C#
<asp:TextBox ID="txtChequeNoCheck" runat="server" MaxLength="10" />
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator7Check" runat="server"
                                    ControlToValidate="txtChequeNoCheck" Display="Dynamic" ErrorMessage="Invalid"
                                    ValidationExpression="/^0?\d+$/" ValidationGroup="paymentCheck" SetFocusOnError="true"></asp:RegularExpressionValidator>




This ValidationExpression="/^0?\d+$/" wont accept start form 0.

Like 786345 is correct and also 0786345 this also correct.


I want regular expression for accept numeric numbers and may be start from Zero

Please let me know.
Posted

C#
ValidationExpression="/^[0-9]+$/"
 
Share this answer
 
This should work i hope

JavaScript
"/^[0-9]*$/"
 
Share this answer
 
Try this regular expression "\d+$"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900