note 52102 deleted from function.preg-split by betz
| From: | betz@php.net | Date: | Thu, 21 Apr 2005 10:50:10 +0000 |
| Subject: | note 52102 deleted from function.preg-split by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88328@lists.php.net to get a copy of this message | ||
Note Submitter: erikg at codepoet dot no
----
In response to tehjahn:
To check if a username has valid chars, you can simply use a regular expression match - your example
could be replaced by:
$userstr = "the jahn!";
if (preg_match("/^[a-zA-Z0-9]*$/", $userstr) == false)
echo 'Invalid characters found in username';
else
echo 'No invalid characters detected...';