[thelist] Dumb PHP question.

Steve Cook sck at biljettpoolen.se
Thu Sep 14 02:20:39 CDT 2000

I was looking at regexps in PHP last night (at home, so this is all from
memory). In your php source directory (if you are running under Linux)
you'll find a directory called regex. In that directory, you can point man
at a file called regex.7 to get some good background information on the
Posix style of regex that PHP uses! 

One of the main bits was that there's a way to check whether certain "atoms"
are numeric which I think was [:isnum:], looking at the information here
http://www.php.net/manual/function.ereg.php it appears that using [0-9] also
works. So I would suggest something along the lines of

if (ereg("^[,.0-9]+$", $amount) {
	do something;
} else {
	complain loudly;


   WapWarp - http://wapwarp.com
 Wap-Dev - http://www.wap-dev.net
 Cookstour - http://cookstour.org

> -----Original Message-----
> From: Eduardo Dominguez [mailto:edmz at emonterrey.com]
> Sent: den 14 september 2000 01:10
> To: thelist at lists.evolt.org
> Subject: RE: [thelist] Dumb PHP question.
> Regular expressions will do that. I am not good with regex, but i know
> that is trivial. You should be able to find a regex that solves that
> problem.
> You should be using the ereg() function of php.
> http://www.php.net/manual/function.ereg.php for more info.
> -----Mensaje original-----
> De: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]En nombre de Michael Barrett
> Enviado el: Wednesday, September 13, 2000 3:40 PM
> Para: thelist at lists.evolt.org
> Asunto: [thelist] Dumb PHP question.
> howdy howdy
> I have a dumb PHP quandry.
> I want to prevent users from entering anything but numbers 
> (currency) into a
> form, commas and periods/ decimals are ok.
> here is the test URL
> http://flexitimecd.industryimagebank.com/demo/custom_cd.html
> thanks
> -- Michael
> -O^O-

More information about the thelist mailing list