in reply to regex question with balanced text

Not only the $ but also the '
perl -pi <<'PRG_END' s|<!--#include virtual="/ssi/footer.txt"-->|<?php include(\$_SERVER['D +OCUMENT_ROOT'].'/ssi/footer.txt'); ?>|g; PRG_END

s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Replies are listed 'Best First'.
Re^2: regex question with balanced text
by hmbscully (Scribe) on Aug 28, 2007 at 16:45 UTC
    If I use the here doc, how do I use this in conjunction with xargs? I thought that required it to be a one-liner?

    find /home/site/htdocs -name "*.html" | xargs -n 1 perl -pi <<'PRG_END +' s|<!--#include virtual="/ssi/footer.txt"-->|<?php include(\$_SERVER['D +OCUMENT_ROOT'].'/ssi/footer.txt'); ?>|g; PRG_END

    Thows errors like this:

    Can't open perl script "s|<!--#include": No such file or directory. Use -S to search $PATH for it. Can't open perl script "virtual=/ssi/edfooter.txt-->|<?php": No such f +ile or directory. Use -S to search $PATH for it. Can't open perl script "include($_SERVER[DOCUMENT_ROOT]./ssi/edfooter. +txt);": No such file or directory. Use -S to search $PATH for it. Can't open perl script "?>|g;": No such file or directory. Use -S to search $PATH for it.

    I learn more and more about less and less until eventually I know everything about nothing.