Re: Anyone good at regular expressions???

From: Date: Wed, 23 Aug 2000 21:28:57 +0000
Subject: Re: Anyone good at regular expressions???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13222@lists.php.net to get a copy of this message
off the top of my head (pcre style): if(!preg_match("/^[\w\d][\w\d ]*[\w\d]$/",$username)) exit(); note: the username has to be at least two characters long or it will not match. Monte ssonne wrote: > > I've been stumped for a few days at how to write one expression to do the > following...any help is appreciated. > I have a name and password form and I want to check that.... > only letters a-z and A-Z and numbers 0-9 are allowed, > and i'd like to allow the space character, but NOT at the beginning or end > of the string > > I've managed to get it to work, but not in one expression...had to use a > few, lol > > TIA > -Steve Sonne > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#13222) next »