note 46212 added to function.preg-replace

From: Date: Sat, 02 Oct 2004 15:00:28 +0000
Subject: note 46212 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-77744@lists.php.net to get a copy of this message
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? ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46212 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46212&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+46212&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#77744) next »