I was thinking that the - at the front is a special case, as it can ONLY appear at the very front or not at all. maybe pull it out?
^[-]?[0-9\.]*[0-9]+ or should I shut up and return to making php errors by the dozen? On Wed, Apr 20, 2011 at 2:53 PM, Judah McAuley <ju...@wiredotter.com> wrote: > > I just realized that it probably needs one more revision to this: > > ^[0-9\.-][0-9\.]+[0-9]+ > > The problem with the previous one is that it would allow -. as a > number, which it obviously is not. The new regex requires the last > character to be a number. This should be fine in almost all > situations, so -.9 would pass but -9. would not. Now, technically, -9. > is a number if you are keeping track of margin of error calculations > as it says you know the precision of the number to the single whole > number. Almost no one would ever write it that way except a few > pedantic physicists. And those folks usually don't have error margins > in that realm. But it is technically possible, so there's the caveat. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:336571 Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm