note 55583 added to function.preg-match
| From: | TeguhIskanto : kamprettos yahoo | Date: | Mon, 08 Aug 2005 07:38:10 +0000 |
| Subject: | note 55583 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93225@lists.php.net to get a copy of this message | ||
A simple example on how to create a string verification function. This might be useful esp for those
who want to check the input from a form
function is_ok_string($buff_string)
{
# your string OK standard
$std_ok_string = "/[^0-9a-z_]/i" ;
# regex
if (!preg_match($std_ok_string, $buff_string))
{
#string is OK
return 1 ;
} else {
#string is *not* OK
return 0 ;
}
}
$string_result = is_ok_string($user_name_input);
----
Manual Page -- http://www.php.net/manual/en/function.preg-match.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55583
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55583&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55583&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55583&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55583&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55583&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55583&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55583&report=yes
Search -- http://master.php.net/manage/user-notes.php