note 102533 rejected from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Feb 2011 01:33:45 +0000 |
| Subject: | note 102533 rejected from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-177148@lists.php.net to get a copy of this message | ||
Note Submitter: adv at fotobase dot org
----
Please, help me!
What is the valid regex for filtering logins?
The login consists only from characters a-z A-Z, 0-9
but there is no whitespaces.
for example
somebody - valid login
somebody123 - valid login
123somebody123 - valid login
et cetera
some body - invalid login
these regexs doesn't works for me
/[0-9A-Za-z]/i
/[0-9a-Z]/i
/[0-9a-Z^ ]/i
/[0-9a-Z^\s]/i
i use this code
if (preg_match("/[0-9A-Za-z]/i",$login))
{
$ok=1;
}