note 46212 deleted from function.preg-replace by tomsommer

From: Date: Sat, 02 Oct 2004 16:57:33 +0000
Subject: note 46212 deleted from function.preg-replace by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77751@lists.php.net to get a copy of this message
Note Submitter: lewiswright at gmail dot com ---- When writing a regexp to turn {blah} into $blah but not turn \{blah} I noticed that using \\ didn't work. This didn't work preg_replace("/([^\\])\{([-a-zA-z0-9\_]+)\}/", "\\1\$\\2", $str); Yet this did: preg_replace("/([^\\\])\{([-a-zA-z0-9\_]+)\}/", "\\1\$\\2", $str); (I know its probably not the best way to do it but I only need to do it for a small script that only I will use.) Any ideas why?

« previous php.notes (#77751) next »