Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Tokeparser extraction

by jonnyfolk (Vicar)
on Feb 20, 2010 at 14:39 UTC ( #824386=perlquestion: print w/replies, xml ) Need Help??
jonnyfolk has asked for the wisdom of the Perl Monks concerning the following question:

The following code:
my $item = qq~<tr> <td><font size=2><B><a href='javascript:void(0);' onClick="javascr'../exc_details.asp?PID=0000','Nyhet','toolbar=no,loc +ation=no,directories=no,status=no,menubar=no,scrollbars=yes,resizeabl +e=yes,width=380,height=500');" href="javascript:void(0);">EXCAVATOR</ +A></B></font></td> <td><font size=2>1 Jul 2010</font></td> <td><font size=2>10 Aug 2010</font></td> <td><font size=2><B>Shellshocked</B></font></td> </tr>~; my $p=HTML::TokeParser->new(\$item); my $data = $p->get_text(['</td>']); print "$data\n";
Creates output:
EXCAVATOR 1 Jul 2010 10 Aug 2010 Shellshocked
How can I cleanly just get the two dates fields?

Replies are listed 'Best First'.
Re: Tokeparser extraction
by Corion (Pope) on Feb 20, 2010 at 14:56 UTC

    Just filter for things that look like a date? Or consider HTML::TableExtract, if what you really want to do is parse the table?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://824386]
Approved by AnomalousMonk
[LanX]: First day after holidays ... and already stressed by the fact that colleagues changed stuff without communication ... apparently I'm the only one trying to fight entropy
[Corion]: LanX: The command is always in the history if you typed it in before. If you didn't type the command into the command line, it will not be there. I think there is doskey which can stuff command lines into the history
LanX damns the cult of CB ;-)
[LanX]: please forget my last 3 posts
[LanX]: Yeah option a doesn't go into history
[LanX]: probably I need to teach the app to restart after C-c Kill
[Corion]: LanX: Maybe have an infinite-loop cmd file? Much easier than trying to manage that from within Perl IMO
[Corion]: Alternatively, relaunch the application from cron (or a Windows cron) every minute
[LanX]: will try infinite loop ...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2017-03-27 15:50 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (320 votes). Check out past polls.