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&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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |