Re: Validating spaces in Form Input

From: Date: Thu, 09 Nov 2000 11:18:15 +0000
Subject: Re: Validating spaces in Form Input
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24611@lists.php.net to get a copy of this message
In article <3A0138A1.CDDB1FED@nestworks.com>, jalerta@nestworks.com wrote: make your regex this: ^[[:alnum:][:space:]]$ Jeff Warrington > Hi All, > > I am trying to validate Form INPUT to ensure that only alphanumeric > info is being entered. > > I am using the following code to do it: > > if(!eregi("^[[:alnum:]]+$", $string)) > { > return(false); > } > > > The above code works fine with a single word string, however, with > input where there are spaces in the string (e.g. a street address), it > fails. > > Does anyone know of a regular expression that will validate > alphanumeric strings with spaces? > > Thanks in advance for any and all help. > > > jeff alerta jalerta@nestworks.com > >

« previous php.general (#24611) next »