Re: ereg_replace() help

From: Date: Wed, 27 Sep 2000 20:22:55 +0000
Subject: Re: ereg_replace() help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-17782@lists.php.net to get a copy of this message
David, Do you need something like this? <?php $text = "one two label four otherstuff"; $replacement = "guess"; eregi("^.*label[[:space:]](.*)[[:space:]].*$",$text,$arr); echo $arr[1]."<br>"; $newtext = eregi_replace($arr[1],$replacement,$text); echo $newtext."<br>"; ?> Toby ----- Original Message ----- From: "David Newcomb" <davidn@vnvi.com> To: "php-general" <php-general@lists.php.net> Sent: Wednesday, September 27, 2000 12:08 PM Subject: [PHP] ereg_replace() help > > Hi, > > Could some one give a hand with this regular express? > > The string will follow the patten of > > something<whitespace(s)>something<whitespace(s)>something<whitespace(s)>labl > e > <whitespaces><thingIwant><rest of varible> > eg: > $text= "one two label four > otherstuff"; > or > $text = "one two label > four > otherstuff"; > or > $text = "one two label<tab>four otherstuff"; > > and the <thingIwant> in the example is "four" > > This is what I have so far: > > $name=ereg_replace(".*label[ \n]([A-Za-z0-9]+).*","\\1",$text); > > but I am getting confused! > > Can anyone help? > > David. > > > > -- > 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 (#17782) next »