wyrd33
05-06-2006, 12:04 AM
Sometimes I have $1 in text, which are being parsed by regular expressions. The regular expressions are taking the $1 in the text literally. e.g.
$text = "$1 cookie.";
$replace = "cookie from $2.";
$text = preg_replace("/cookie/i", $replace, $text);
print $text;
Text will output "$1 cookie from ..". How can I avoid this?
$text = "$1 cookie.";
$replace = "cookie from $2.";
$text = preg_replace("/cookie/i", $replace, $text);
print $text;
Text will output "$1 cookie from ..". How can I avoid this?