[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl-WebCGI] pattern matching in html files



This is just a note of thanks to the perl mongers on this list.  I wrote
this message (below) about two weeks ago and received several replies.  Your
suggestions saved my skin.

Thank you,

Robert Terwilliger
raterwil@ucla.edu

********************************************

If I have an html file and I want to reduce "$string," which contains the
whole text of the file, to just the content of the <h1>'s, what do I do?

I have tried the following thus far but trial and error have thus far not
provided me with an answer.

if ($string =~ m%<h1>(.*)</h1>%)ig {
    $string = $1;
}

It seems that this would only grab the first <h1>, not all of them.  How do
I grab all of them?


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org