Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expression problem 1

Status
Not open for further replies.

mchoudhury

Programmer
Nov 26, 2004
71
GB
Hi guys,
i have this reqular expression in my code where if a uaer enters anything that is not numeric and an error should be shown:

<asp:regularexpressionvalidator id="expression1" runat="server" ValidationExpression="\d*$" ControlToValidate="LocalDay" text="*" Errormessage="Please only enter numeric numbers in Local Daytime box"></asp:regularexpressionvalidator>

At the moment it also does not allow me to insert value like 1.0, 23.0, 45.6776 basicall it does not allow any decimal value.
Any idea how i could amend the validation so any values afterthe (.) will be allowed to be inserted

Thanks
Mac
 
Try this:

ValidationExpression="^\d*\.?\d*$"

Now you should be able to use whole numbers as well as decimals.

-Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top