[CMI.PM] Multi-line substitution?

Mitch Kutzko mitch at ncsa.uiuc.edu
Tue Jan 20 18:03:18 CST 2004


Hi,  folks -- I'm trying to remove the following three lines from a website
I run, and these three lines occur in many files on the site:

	<p>
	
	<table border="0" width="800" cellpadding="15" cellspacing="0">


I've looked in the Cookbook and on the web, and by all the accounts and
examples I can find, this should work, but it doesn't.  Doesn't do a dang
thing, in fact.  (Which tells me it's not matching, of course, but I don't
see how it can not match.)


	#!/usr/bin/perl -pi.old
	s/<p>.*<table border="0" width="800" cellpadding="15" cellspacing="0">//s

If I reduce the match string down to the whole <table> command by itself,
it works fine.  Basically, it just refuses to match across more than one
line.  

I've tried the following, all with the same utter lack of results over
multiple lines:

	#!/usr/bin/perl -pi.old
	s/<p>.*<table border="0" width="800" cellpadding="15" cellspacing="0">//sm

	#!/usr/bin/perl -pi.old
	s/<p>.*<table border="0" width="800" cellpadding="15" cellspacing="0">//smg

	#!/usr/bin/perl -pi.old
	s/<p>.*<table border="0" width="800" cellpadding="15" cellspacing="0">//m

	#!/usr/bin/perl -pi.old
	s/<p>.*<table border="0" width="800" cellpadding="15" cellspacing="0">//mg

	#!/usr/bin/perl -pi.old
	s/<p>.*<table border="0" width="800" cellpadding="15" cellspacing="0">//sm

	#!/usr/bin/perl -pi.old
	s/<p>.*?<table border="0" width="800" cellpadding="15" cellspacing="0">//s

	#!/usr/bin/perl -pi.old
	s/<p>..<table border="0" width="800" cellpadding="15" cellspacing="0">//s

	#!/usr/bin/perl -pi.old
	s/<p>...<table border="0" width="800" cellpadding="15" cellspacing="0">//s

	#!/usr/bin/perl -pi.old
	s/\<p\>.*\<table border="0" width="800" cellpadding="15" cellspacing="0"\>//s

etc...  (You get the idea by now, I'm sure...  ;-) )

This should be (and, of course, will turn out to be) painfully simple to
do.  What am I not doing?


Thoughts?  Ideas?  Suggestions?  Tequila?

;-)

As always, thanks in advance!

Mitch
--
Mitch Kutzko | mitch at dast.nlanr.net | mitch at ncsa.uiuc.edu | 217-333-1199
http://hobbes.ncsa.uiuc.edu/



More information about the Champaign-Urbana mailing list