LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Perl - Parsing HTML (https://www.linuxquestions.org/questions/programming-9/perl-parsing-html-472152/)

rjcrews 08-08-2006 09:21 PM

Perl - Parsing HTML
 
Hi all -

I am using perl modeules WWW:Mechanize and HTML:TokeParser to grab some html. I am having problems formatting/parsing the output.

A snipet of what I get that Id like to work with:

Code:

&nbsp;<br>
&nbsp;<br>
Your Name<br>
&nbsp;<br>
&nbsp;<br>
Clock<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>

I basically have a file that is output with all the text moved to the left (I trimmed all white from right and left)

Anyone know a quick way to pull the line Clock out? or remove all the other stuff? I was leaving the <br> code in to terminate the line, bc I was having problems determing end of lines.

Any ideas are appreciated.

chrism01 08-09-2006 12:05 AM

How about a loop with a regex for /Clock/ ?
Depends what you mean by pull out I guess.

bigearsbilly 08-09-2006 03:05 AM

for example:

Code:


print m/(Clock)/  while (<DATA>);


__DATA__
&nbsp;<br>
&nbsp;<br>
Your Name<br>
&nbsp;<br>
&nbsp;<br>
Clock<br>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>


rjcrews 08-09-2006 07:36 AM

I kind of want to remove all the &nbsp;<br> stuff to leave the other parts, but I think I know how to apply the examples. thanks


All times are GMT -5. The time now is 01:05 AM.