Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 30th, 2004, 07:11 AM
Authorized User
 
Join Date: Sep 2004
Location: West Midlands, , United Kingdom.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nitin_sharma Send a message via Yahoo to Nitin_sharma
Default RegExp

I Have this regular exp :
RegExp("^\\d*\\.\\d{0," + pDp + "}$")
which matches any number with upto 2 decimal digits , how can I make it work to even accept digits with no decimal.
As it moment it doesnt accept 12 but does accept 12.00
cheers

 
Old November 30th, 2004, 07:18 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Code:
RegExp("^\\d*(?:\\.\\d{0," + pDp + "})?$")
Should do it.

Cheers,

Chris

 
Old November 30th, 2004, 07:21 AM
Authorized User
 
Join Date: Sep 2004
Location: West Midlands, , United Kingdom.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Nitin_sharma Send a message via Yahoo to Nitin_sharma
Default

You are a star!!!!
Cheers
Nitin





Similar Threads
Thread Thread Starter Forum Replies Last Post
RegExp Problem Abbas Classic ASP Professional 0 August 2nd, 2006 10:48 AM
Regexp how to (also Urgent) NEO1976 Javascript 1 July 10th, 2006 08:54 AM
RegExp crmpicco Javascript How-To 0 July 7th, 2005 05:59 AM
RegExp crmpicco Classic ASP Basics 0 June 6th, 2005 05:54 AM
regexp problem godhsf80 PHP How-To 2 March 10th, 2004 04:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.