note 28817 deleted from function.ereg by kennyt
| From: | kennyt@php.net | Date: | Wed, 26 Jan 2005 03:49:25 +0000 |
| Subject: | note 28817 deleted from function.ereg by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83971@lists.php.net to get a copy of this message | ||
Note Submitter: sev_95 at yahoo dot com
----
I'm in the ski business and had to do one to verify shoe size entry.
This regex will accept digits from 1 to 19 by itself, or 1 to 19 with an optional .0 or .5 on the
end, it wont accept greater than 19 or .1 .4, etc. only .0 or .5 (Shoes only have half sizes).
$f_value = <your shoe size>;
if(!ereg('^([1]{1}[0-9]{1}|[1-9]{1})(\.[05])?$' ,$f_value)) {
echo "Invalid Input";
exit;
}
Not that anyone will be able to use this exactly, but I found reading what other people have done
helps me understand regex better.
Hope this helps,
Scott