Re: ereg_replace()

From: Date: Sat, 08 Jul 2000 23:27:07 +0000
Subject: Re: ereg_replace()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-5574@lists.php.net to get a copy of this message
Brian Clark wrote: > > var $version = ereg_replace("[\$]", "", '$Revision: 1.8 $'); > > The above $version holds the string Revision: 1.8 > > var $version = ereg_replace("\$", "", '$Revision: 1.8 $'); > > The above $version holds nothing. > > Why does ereg_replace() require [] around the pattern? It doesn't, but if you use double quotes you need to escape twice (once for the php parser and once to tell ereg its really the dollar sign and not an end-of-line metacharacter): $version = ereg_replace("\\\$", "", '$Revision: 1.8 $'); or use single quotes: $version = ereg_replace('\$', "", '$Revision: 1.8 $'); Ciao, Andreas

« previous php.general (#5574) next »