Re: [PHP] Newbie pattern question

2004-11-05 Thread -{ Rene Brehmer }-
At 19:59 05-11-2004, Greg Donald wrote: On Fri, 5 Nov 2004 20:55:00 +0200, Phpu <[EMAIL PROTECTED]> wrote: > if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) { if(ereg("^[a-zA-Z0-9_\ ]{2,30}$", $name)) { If you use ereg, use [[:blank:]] instead of an actual space, that allows for tabs and other variants

Re: [PHP] Newbie pattern question

2004-11-05 Thread Frantzcy Paisible
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" <[EMAIL PROTECTED]> wrote: > Hi, > I have this function > > function validate_name($name) { > > if(ereg("^[a-zA-Z0-9_]{2

Re: [PHP] Newbie pattern question

2004-11-05 Thread Greg Donald
On Fri, 5 Nov 2004 20:55:00 +0200, Phpu <[EMAIL PROTECTED]> wrote: > if(ereg("^[a-zA-Z0-9_]{2,30}$", $name)) { if(ereg("^[a-zA-Z0-9_\ ]{2,30}$", $name)) { Need to allow spaces in the regular expression. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ --

[PHP] Newbie pattern question

2004-11-05 Thread Phpu
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? Thank