hmbscully has asked for the wisdom of the Perl Monks concerning the following question:
I'm attempting to convert a website from SSIs to PHP includes.
This is the perl and regex I'm using:
perl -pi -e 's|<!--#include virtual="/ssi/footer.txt"-->|<?php include($_SERVER['DOCUMENT_ROOT'].'/ssi/footer.txt'); ?>|g'
Which matches and replaces the SSI with <?php include(./ssi/edfooter.txt); ?> losing the '$_SERVER['DOCUMENT_ROOT'].'' in translation.
I understand that the parens and the $ are causing the problems and things need escaped, but I've tried everything I can think of to try and escape that part. Each time I escape one thing or quote one part another way, it seems that there is another part of the expression that then can't be quoted. I'm not sure this match is even possible?
thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex question with balanced text
by Skeeve (Parson) on Aug 28, 2007 at 15:55 UTC | |
by hmbscully (Scribe) on Aug 28, 2007 at 16:45 UTC | |
|
Re: regex question with balanced text
by Codon (Friar) on Aug 28, 2007 at 19:43 UTC |