Re: Preg_match.

From: Date: Fri, 08 Dec 2000 17:15:30 +0000
Subject: Re: Preg_match.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-29375@lists.php.net to get a copy of this message
actually, I wasn't exactly what you wanted. Try this: if (preg_match("/^[^._][a-zA-Z0-9._]*[^._]$/",$string) && strlen($string) < 21) echo "good"; else echo "bad"; That should cover it. Monte Ohrt wrote: > > /^[^._][a-zA-Z0-9._]{2,20}[^._]$/ > > Jonatan Bagge wrote: > > > > Hi > > > > I'm trying to make a regular expression for use with preg_match to meet > > the following criterias: > > > > May contain: a-z A-Z 0-9 _ . > > May not start nor end with: . _ > > Must be: 2-20 characters long > > > > I know this is a really easy one but let's face it I truly suck at > > regular expressions. > > Also..Please don't flame me for being OT. > > > > -- > > 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 > > -- > Monte Ohrt <monte@ispi.net> > http://www.ispi.net/ > > -- > 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 -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.general (#29375) next »