note 52102 added to function.preg-split
| From: | erikg at codepoet dot no | Date: | Thu, 21 Apr 2005 09:29:52 +0000 |
| Subject: | note 52102 added to function.preg-split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88314@lists.php.net to get a copy of this message | ||
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...';
----
Manual Page -- http://www.php.net/manual/en/function.preg-split.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52102
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52102&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52102&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52102&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52102&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52102&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52102&report=yes
Search -- http://master.php.net/manage/user-notes.php