Re: Newbie pattern question
| From: | Frantzcy Paisible | Date: | Fri, 05 Nov 2004 18:52:50 +0000 |
| Subject: | Re: Newbie pattern question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201306@lists.php.net to get a copy of this message | ||
Hi,
Try adding a space([a-zA-Z0-9_] => [a-zA-Z0-9_ ]), John Doe is false but JohnDoe would be true
in the case below
Frantzcy
On Fri, 5 Nov 2004 20:55:00 +0200,"Phpu" <phpu@go.ro> wrote:
> Hi,
> I have this function
>
> function validate_name($name) {
>
> if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) {
>
> return true;
>
> } else {
>
> return false;
>
> }
>
> }
>
> If i enter a name like John for exemple everything is ok but if i
> enter John Doe the function return false.
>
> Where is the problem?
>
> Thanks
>
--
Unreachability is bliss
--
Sleep, sometime in MAY... if lucky