RE: [PHP] RegExp Problem

From: Date: Wed, 18 Oct 2000 08:45:14 +0000
Subject: RE: [PHP] RegExp Problem
Groups: php.general 
Request: Send a blank email to php-general+get-20845@lists.php.net to get a copy of this message
Oh..ok... since u know about regexp ... what's the diff between.. [A-Za-z0-9] and [A-Z,a-z,0-9] and why was the + sign there... --- Maxim Maletsky <maxim@japaninc.net> wrote: > the example posted after me is better that mine... > > anyway: > > it sounds like this: if (case insensitive ereg is > not only( from the > beginning (^) [ any of this: from a-z, from 0 to 9 > and _ ] to the end ($) ) > ) > then reject.. > > if(!eregi("^[_a-z0-9]+$", $var)) > echo 'rejected'; > > ====================== > the second one is better since it checks directly if > the string is > [alphanumeric(note that the case doesn't matter at > all)] and there's an _ . > then the string is allowed. > > if (!ereg('^[[:alnum:]_]+$', $str)) > echo 'rejected'; > > > I think you should read this: > http://www.phpbuilder.com/columns/dario19990616.php3 > > > Cheers! > > > -----Original Message----- > From: Mukul Sabharwal [mailto:phpguru@yahoo.com] > Sent: Wednesday, October 18, 2000 5:32 PM > To: Maxim Maletsky > Subject: RE: [PHP] RegExp Problem > > > hi, > > thanks... could you possibly explain this stuff... i > know about ^ and $ ... but why was + there.... > > is this correct also : > > eregi("[^_a-z0-9]", $var); > > thanks. > > > --- Maxim Maletsky <maxim@japaninc.net> wrote: > > if(!eregi("^[_a-z0-9]+$", $var)) > > echo 'rejected'; > > > > Just a scratch... > > > > > > -----Original Message----- > > From: Mukul Sabharwal [mailto:phpguru@yahoo.com] > > Sent: Wednesday, October 18, 2000 5:18 PM > > To: php-general@lists.php.net > > Subject: [PHP] RegExp Problem > > > > > > Hi, > > > > I want to do the following : > > > > a variable with the following values to be > accepted > > ... > > > > if $variable contains > > > > (1) numbers > > (2) underscores > > (3) letters > > > > to be approved and anything else to be > disapproved.. > > how do i do this.... > > > > I would like to use pcre for this (preferably) but > > ereg would also do.... > > > > thanks... > > > > __________________________________________________ > > Do You Yahoo!? > > Yahoo! Messenger - Talk while you surf! It's > FREE. > > http://im.yahoo.com/ > > > > -- > > 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 > > > > > -- > > 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 > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Messenger - Talk while you surf! It's FREE. > http://im.yahoo.com/ > > > -- > 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 __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/

« previous php.general (#20845) next »