Re: ereg issues

From: Date: Thu, 10 May 2001 19:15:08 +0000
Subject: Re: ereg issues
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-52335@lists.php.net to get a copy of this message
isn't a \w a word character, meaning a-zA-Z_0-9 (in perl)? if so, that wouldn't match the a-zA-z he originally intended... am i missing something? -jack "..s.c.o.t.t.. [gts]" wrote: > > print preg_replace('/(.*?)(\w{2})(.*)/', '\\2', $blah); > > works for: > > $blah = "*9 scott 777zxsdf"; > and > $blah = "scott"; > > > -----Original Message----- > > From: Jerry Lake [mailto:jerryl@europa.com] > > Subject: [PHP] ereg issues > > > > I'm feeling a bit stupid today > > how do I truncate a string to the > > first two [a-zA-Z] characters ? > > > > this sure isn't working > > <snip> > > $test = "jerry"; > > $test = ereg_replace("^\w*", "^[a-zA-Z]{2}" ,$test); > > </snip> > > -- > 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 (#52335) next »