note 55731 added to function.preg-match
| From: | kamprettos at yahoo dot comTeguhIskanto | Date: | Thu, 11 Aug 2005 19:59:51 +0000 |
| Subject: | note 55731 added to function.preg-match | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93463@lists.php.net to get a copy of this message | ||
A simple function on how to create a string check input ( this might get handy esp for those who are
doing HTML 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 ;
}
}
$str_chk= 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+55731
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55731&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55731&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55731&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55731&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55731&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55731&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55731&report=yes
Search -- http://master.php.net/manage/user-notes.php