preg_replace() in 4.0.4
| From: | Daniel Baldoni | Date: | Sun, 07 Jan 2001 15:53:08 +0000 |
| Subject: | preg_replace() in 4.0.4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-33096@lists.php.net to get a copy of this message | ||
G'day folks,
With the upgrade to 4.0.4, preg_replace() now does substitutions for $n in
the replacement strings (I say strings, because it's the easiest way of doing
mass substitutions over an array). This has caused me severe grief (as there
doesn't appear to be any way to stop it).
I have an application which reads in a PostScript template file and replaces
occurrences of '@' delimited strings with specific values (basically, a
"variable subsituter"). Some of the replacement strings may contain dollar
amounts and so a '$' may (or may not) be present. If a '$' is present in a
string, it will be followed by a digit. When I call preg_replace() in this
application, all 3 arguments are arrays.
What I'm looking for is some alternative method to do what I'm doing without
writing a custom array_walk()er. If str_replace() or ereg_replace() could
work on arrays as preg_replace() does, that'd be fine. Alternatively, if
there was some way to tell preg_replace() to *NOT* do the substitution,
that would work (for me) to.
Any suggestions? Thanks in advance.
--
-------------------------------------------------------+---------------------
Daniel Baldoni BAppSc, PGradDipCompSci | Technical Director
require 'std/disclaimer.pl' | LcdS Pty. Ltd.
-------------------------------------------------------+ 856B Canning Hwy
Phone/FAX: +61-8-9364-8171 | Applecross
Mobile: 041-888-9794 | WA 6153
URL: http://www.lcds.com.au/ |
Australia
-------------------------------------------------------+---------------------
"Any time there's something so ridiculous that no rational systems programmer
would even consider trying it, they send for me."; paraphrased from "King Of
The Murgos" by David Eddings. (I'm not good, just crazy)