Re: regular exp if help

From: Date: Wed, 23 Aug 2000 21:17:33 +0000
Subject: Re: regular exp if help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13221@lists.php.net to get a copy of this message
Hi All i tried this code: if ( !ereg( "([a-zA-Z0-9])" , $Username) ){ exit; } it works when i set $Username="'" but if i use $Username="i'm cool" it says thats ok Any ideas? TIA Chris On Wed, 23 Aug 2000, callen wrote: > Chris Murley wrote: > > > > Hi all, i have a string containing my name > > > > $string = "chris"; > > > > I want to check $string to see if contains any characters other that > > 0-9a-zA-Z and if it does, exit. > > $string="+++"; > > if ( !ereg( "([a-zA-Z0-9])" , $string) ) > { > > do_some_exit_code(); > > } > else { > echo "Was a satandard alpha etc"; > > } > > > > > -- > Christopher C.M. Allen > http://design.driver8.org/ > Email: callen@driver8.org > Cell : 1.715.821.4006 > Home Phone: 1.715.426.6661 >

« previous php.general (#13221) next »