Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Re: Re: Re: Validating Numbers in CGI Script?

by japhy (Canon)
on May 10, 2001 at 19:42 UTC ( [id://79440]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Validating Numbers in CGI Script?
in thread Validating Numbers in CGI Script?

Hmm, actually, I think I meant to make the regex be /^-?(?=\d|\.\d)\d*\.?\d+$/. Yes, that looks far more sane. The other could have matched "1234.", which isn't proper. This one can match "1234", ".1234", and "12.34".

japhy -- Perl and Regex Hacker
  • Comment on Re: Re: Re: Re: Validating Numbers in CGI Script?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Validating Numbers in CGI Script?
by buckaduck (Chaplain) on May 10, 2001 at 21:24 UTC
    I hate to say this, but sometimes I actually need to use numbers like "300." This is sometimes used to denote the difference between 3*10^2 and 3.00*10^2. The latter has three significant digits, while the former has only one.

    But don't fix your regex on my account; I'm sure that my situation is in the minority...

    buckaduck

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://79440]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-24 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found