Home  |  Linux  | Mysql  | PHP  | XML
From:Sean Davis Date:Tue Apr  8 07:44:50 2008
Subject:Re: Extracting TD's from a Text File (Regex Help).
On Tue, Apr 8, 2008 at 8:22 AM,  <sara.samsara@gmail.com> wrote:
> ################ TEXT FILE ##################
>  <td class="PhorumTableRowAlt thread"  style="padding-left: 0px">
>
>             <a href="http://mysite.com/link/here_goes?id=239">LINK</a>
>
>     &nbsp;<span class="PhorumNewFlag"></span></td>
>
>   <td class="PhorumTableRowAlt" nowrap="nowrap" width="150">
>   <a href="http://mysite.com/link/here_goes?id=239">LINK</a> </td>
>     <td class="PhorumTableRowAlt PhorumSmallFont" nowrap="nowrap" width="150">06/11/2007 12:29AM
>   </td>
>  </tr>
>  ############################################
>
>  The text file contains hundreds of tds structure like above. All I need is to extract the td with class "PhorumTableRowAlt thread". I have tried every possible option, but finally I am coming to you for any Regex for it? TIA.
>
>  HERE IS WHAT I AM DOING:
>
>  pen(TXT, "links.txt") or die "Unable to open file";
>  my @links = <TXT>;
>  close (TXT);
>  foreach my $link(@links) {
>  if ($link =~ m|<td class="PhorumTableRow thread" style="padding-left: 0px">(.*?)</td>|gsi) {
>  print "$1";}
>  }
>
>
>
>  But NOTHING coming up. No results.

I didn't look closely at your code--sorry.  But when I see questions
related to HTML parsing, I always wonder if it isn't better to use a
module built to deal with HTML.

http://search.cpan.org/dist/HTML-Parser/

is just one example.

Sean
Navigate in group perl.beginners.cgi at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants