RE: [PHP4BETA] Regex question

From: Date: Mon, 27 Mar 2000 23:29:46 +0000
Subject: RE: [PHP4BETA] Regex question
Groups: php.version4 
Request: Send a blank email to php-version4+get-12700@lists.php.net to get a copy of this message
I do not recognize the error but you are missing slashes in the first parameter: $newline = pgreg_replace("/%%(\w+)%%/", "$HTTP_POST_VARS[\\1]", $line); -----Original Message----- From: Dan Murphy [mailto:dmurphy@nbinteractive.com] Sent: Monday, March 27, 2000 3:05 PM To: php4beta@lists.php.net Subject: [PHP4BETA] Regex question setting up a simple template library I am running into the following problem $newline = pgreg_replace("%%(\w+)%%", "$HTTP_POST_VARS[\\1]", $line); generates the following error. Parse error: parse error, expecting T_STRING' or T_VARIABLE' or `T_NUM_STRING' in /export/home/virtual01/bsc/test.php on line 10 getting rid of the $HTTP_POST_VARS and just replacing with \\1 <file://\\1> works correctly and vice versa if I remove the \\1 <file://\\1> and replace with something like $HTTP_POST_VARS[username] it works fine. the goal is to prefill in form values... pretty straight forward. the same thing works in perl ..well the equivalent expression anyway $line =~ s/%%(\w+)%%/$MY_DATA{$1}/g; Just wondered if anyone new a quick work around. thanx, Daniel Murphy ps. latest snapshot w/ apache 1.3.12 on Solaris 8

« previous php.version4 (#12700) next »