9/26 in a perl script I'm trying to write a reg exp to replace a
multiline block of text with another multiline block of text but
can't seem to get it right. any advice? thanks.
\_ example?
\_ if he had an example he wouldn't need help, would he?
\_ try subbing a variable for another variable, so you don't have
to worry about how to escape newlines within s// expressions
\_ i am trying to do the samething without much success. I am trying
to remove a mult-line text block with certain pattern (for example
"Do You Yahoo?..." Let me know if any of you have any cool idea
on this supposely simple problem -kngharv
\_ http://tinyurl.com/oya1 [removes ads from yahoo msgs]
I ran this through s2p, did a little cleanup, and have been
using it in my procmail script for about a year.
\_ Two things to keep in mind:
1) You can't do this with a straight perl -pe 's/..../' from the
command line (without -0777), so I'll assume you have the whole
text to be substituted on in a scalar ($text or something).
2) Use /s at the end of your regexp: $text =~ s/.../.../gs;
This will make things like . match \n as well, so that your
matches won't fail at the end of a line. When in doubt, RTFM:
perlre(1) --dbushong |