Regex question
| From: | Dan Murphy | Date: | Mon, 27 Mar 2000 22:04:53 +0000 |
| Subject: | Regex question | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-12691@lists.php.net to get a copy of this message | ||
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 works correctly and
vice versa if I remove the \\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