Re: eregi problem

From: Date: Sun, 03 Apr 2005 16:41:30 +0000
Subject: Re: eregi problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-212116@lists.php.net to get a copy of this message
you'd be better off with something like if(preg_match('#^[a-z0-9]+$#i', $GP['sifre'])) { echo 'contains only alphanumeric chars'; } else { echo 'contains characters which are not alphanumeric'; } - tul andreja@beogradnet.com wrote:
I really dont know :) <emre@vt.com.tr> wrote in message news:009501c53861$2a92e3e0$bf6aaec3@hermoine...
I m trying to check $GP[sifre] variable, $GP[sifre] must consist of alpha numeric chars only. here, how I check the variable: if((eregi("[^a-zA-Z0-9]",$GP[sifre]) echo 'true'; else echo 'false'; It works if variable starts with alphabetic chars only. for example this returns 'ok' $GP[sifre]='blabla234243'; but this does not work: (if variable starts with numeric chars) $GP[sifre]='3243242blabla'; second one returns false, couldnt figure out the problem here. any help ?


« previous php.general (#212116) next »