note 28817 added to function.ereg
| From: | sev_95 at yahoo dot com | Date: | Fri, 24 Jan 2003 19:59:49 +0000 |
| Subject: | note 28817 added to function.ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42703@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/function.ereg.php
http://master.php.net/manage/user-notes.php?action=edit+28817
http://master.php.net/manage/user-notes.php?action=delete+28817
http://master.php.net/manage/user-notes.php?action=reject+28817