Re: Exact string replacement...

From: Date: Sat, 09 Feb 2002 08:38:35 +0000
Subject: Re: Exact string replacement...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84090@lists.php.net to get a copy of this message
* Desikan (desikb4u@fastmail.fm) [Feb 09. 2002 03:33]: > hi there, Backatcha, > Have u tried this... > <?php > $string = 'foo'; > print preg_replace("/^\s$string\s/",' ','bfoo foo foobar.') . > "\n"; > print eregi_replace("^[[:space:]]".$string."[[:space:]]",' > ','bfoo > foo alfoobar.') . "\n"; > ?> > This is not working properly.. > Output I got is.... > bfoo foo foobar. bfoo foo alfoobar You do realize that ^ is matching the beginning of a string, right? Take out the ^ in each and you'll get the correct result. > help me out.... Hope that helps. -- Headers set. CCs on list replies -> bit bucket. Brian Clark | The land of the free, and the home of the brave. Fingerprint: 07CE FA37 8DF6 A109 8119 076B B5A2 E5FB E4D0 C7C8

« previous php.general (#84090) next »