Re: eregi() problem
| From: | Danny Shepherd | Date: | Mon, 22 Apr 2002 00:21:22 +0000 |
| Subject: | Re: eregi() problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93925@lists.php.net to get a copy of this message | ||
Try:
if (!eregi('^[a-z_\-]{0,}$', $_POST['vpis_ime']))
echo "wrong char";
That'll sort it for everything except [ and ], which I can't find any way of
checking for :-( Anyone else have any ideas?
HTH anyway.
Danny.
----- Original Message -----
From: "Gregor Jaksa" <gre-gor@delphi-si.com>
To: <php-general@lists.php.net>
Sent: Monday, April 22, 2002 1:04 AM
Subject: [PHP] eregi() problem
> if (!eregi("^[[:alpha:]]$", $HTTP_POST_VARS["vpis_ime"]))
> echo "wrong char";
>
> why does this always return "wrong char" no matter what value is in
vpis_ime
> ... i tried "blah", "242234" "bla242h" .. every single time i get
> "wrong
> char". im using PHP 4.1.2
>
> basicly is what i want is to check string if it contains only charaters
from
> a to z and chars _ - [ ] . Can somebody write me a working function ?
>
> thx in advance