note 52692 added to function.eregi
| From: | somebody at somewhere dot com | Date: | Tue, 10 May 2005 04:35:37 +0000 |
| Subject: | note 52692 added to function.eregi | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89189@lists.php.net to get a copy of this message | ||
Say you want to validate a random sized string (at least one character though), and make sure it
DOESN't contains anything BUT these characters: [:space:]a-zA-Z0-9_.-
function valid_name($name)
{
// return FALSE if it contains characters which
// which ARNT on the specified list
if(ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $name))
{
return false;
}
else
{
return true;
}
}
----
Manual Page -- http://www.php.net/manual/en/function.eregi.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52692
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52692&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52692&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52692&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52692&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52692&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52692&report=yes
Search -- http://master.php.net/manage/user-notes.php