note 55731 deleted from function.preg-match by mazzanet
| From: | mazzanet@php.net | Date: | Sat, 17 Sep 2005 11:25:05 +0000 |
| Subject: | note 55731 deleted from function.preg-match by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95329@lists.php.net to get a copy of this message | ||
Note Submitter: kamprettos at yahoo dot com Teguh Iskanto
----
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) ;