note 20137 deleted from function.preg-replace by alindeman

From: Date: Sat, 23 Mar 2002 20:40:44 +0000
Subject: note 20137 deleted from function.preg-replace by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-28127@lists.php.net to get a copy of this message
A simple $rv = preg_replace("/\$$i\/", $replacement, "subject") does not work as expected. I wanted to use it for own i18n functions to replace in Strings like "Step $1 of $2" the appropriate positions with the appropriate function arguments. A preg_match test makes me think that the $ sign cannot be escaped correctly. If I try a match on \$ it works but a match on \$1 does not work then the string contains $1... That works just fine in Perl...

« previous php.notes (#28127) next »