^[\d]*([.]?[\d]{1,2})?$

there that will catch 9, 9.9, 9.99, will not catch 9. 9.9.9, etc



On Mon, 10 Jan 2005 13:51:23 -0600, Greg Morphis <[EMAIL PROTECTED]> wrote:
> I think this will work..
> ^\d{1,2}.\d{1,2}$
> 
> (not tested)
> 
> 
> On Mon, 10 Jan 2005 14:43:27 -0500, DURETTE, STEVEN J (AIT)
> <[EMAIL PROTECTED]> wrote:
> > Hi All,
> >
> > Need some help with a regex.  What I'm trying to do is validate and
> > input in javascript.
> >
> > The users are allowed to input a number.
> >
> > It can be in the following formats:
> > 9
> > 9.9
> > 9.99
> > .99
> > .9
> >
> > (9 used inplace of any digit.)
> >
> > I tried using \b[0-9.]+  and I've tried \b[\d]*([.]?[\d]{0,2})? and I've
> > tried  ([\d]*([.][\d]{1,2})?){1} but I can't seem to get the response
> > that I want.
> >
> > The user can still input numbers such as 1.25.25 and it will pass the
> > regex test.
> >
> > To be more specific in what I'm looking for, the users are putting in
> > hours and partial hours.
> > There can be any amount of hours, but partial hours are limited to .0,
> > .00,.25, .5, .50, .75 or no decimal part whatsoever. (I've been trying
> > to do the .25, .5, etc in another part of the javascript, but if I can
> > do it in the regex even better.)
> >
> > Anybody got any ideas.
> >
> > Thanks
> > Steve
> >
> > 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189836
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to