Bingo! The /s did the trick.

Sorry for not supplying the input. For those interested, here's a quick test.

use strict; my $lsdata; while (<>) { $lsdata .= $_; } # Add the /s option to make this work my @table = $lsdata =~ m/(<tr.*?<\/tr>)/g; print $#table;

And here's some sample data to use:

<!-- Generated HTML --><html><head><title>Now Playing</title><meta htt +p-equiv="Content-Type" content="text/html; charset=UTF-8"><h1>Now Pla +ying</h1> <table cellpadding="7" width="100%"> <tr bgcolor="E5E5C5"> <th width="1%"> <th width="1%">Source</th> <th>Description</th> <th width="5%">Date</th> <th width="5%">Size</th> <th width="5%">Links</th></tr> <tr bgcolor="F5F595"> <td> <td align="center" valign="top"><img src="logo-65725.png" alt="BBCAMHD +-W"></td> <td align="left" valign="top"><b>TV Show Title</b><br>TV Show Descript +ion</td> <td align="center" valign="top" nowrap>Sat<br>4/14</td> <td align="center" valign="top" nowrap>1:01:00<br>6.03 GB</td> <td align="center" valign="top" nowrap><a href="download/tv-show-file- +name">Download MPEG-PS</a><br><a href="download/tv-show-file-name</a> +</td></tr> <tr bgcolor="F5F595"> <td align="center" valign="top"><img src="images/folder.png"></td> <td> <td valign="top"><b>Folder Name</b></td> <td align="center" valign="top" nowrap>Fri<br>4/13</td> <td align="center" valign="top">2 items<br></td> <td align="center" valign="top"><a href="TiVoConnect?Command=QueryCont +ainer&amp;Container=%2FNowPlaying%2F17%2F55067240">folder</a></td></t +r> </table>2 items, <a href="index.html?Recurse=Yes">classic</a>.<p><font + size="-2">This feature is not supported. The TiVo license agreement +allows you to transfer content to up to ten devices within your house +hold, but not outside your household. Unauthorized transfers or dist +ribution of copyrighted works outside of your home may constitute a c +opyright infringement. TiVo reserves the right to terminate the TiVo +service accounts of users who transfer or distribute content in viola +tion of this Agreement. </font></body></html>

Without the /s option, the test code shows "-1" (no matches). With it, it shows "2" (3 matches - which is correct).

Thanks again, all!


In reply to Re^2: Why isn't my global matching regex working? (update: /s modifier) by jdseymour
in thread Why isn't my global matching regex working? by jdseymour

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.