regular expression for numbers between 5 - 120

Anthony Matovu
Anthony Matovu used Ask the Experts™
on
help me with regular expression for numbers between 5 to 120

I am using asp. net 3.5
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Hi!
Try "[5-9]|[1-9][0-9]|1[0-1][0-9]|120"
Commented:
I would use a rangevalidator instead:


<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="RangeValidator" Type="Integer" MinimumValue="5" MaximumValue="120" ControlToValidate="TextBox1"></asp:RangeValidator>

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial