I'm not sure how your block of html up there should be broken up. Is it all one line or is it over many lines? On the assumption that it _might_ sooner or later be over several lines I offer you the following code:
my $start = q{<font\s+face='arial,helvetica'\s+size='-2'>&nbsp;}; my $end = q{</font></td>}; my @list; { local $\ = ""; # file slurping mode my $filecontents = <>; # take in the whole file @list = ($filecontents =~ /$start(.*?)$end/sg); } print "\n\n\nDOODAH: @list\n";
You'll notice that we don't really need to look out for the td tag here, as what we want is between font tags. You might need to watch for this. We use \s+ instead of a literal space, because this will catch newlines.

Using the /s modifier on our regular expression allows . to match newlines as well.

Calling the regular expression in a list context, and using the /g modifier will ensure that all possible matches are stored in our array @list. Likewise using q{} to quote our variables means that we don't need to worry about their contents.

This code works for me on the snippet of html that you provided.

Good luck.


In reply to Re: html tag matching confusion by jarich
in thread html tag matching confusion by moonlord

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.