LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-08-2006, 09:21 PM   #1
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Rep: Reputation: 30
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.
 
Old 08-09-2006, 12:05 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,352

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
How about a loop with a regex for /Clock/ ?
Depends what you mean by pull out I guess.
 
Old 08-09-2006, 03:05 AM   #3
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
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>
 
Old 08-09-2006, 07:36 AM   #4
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Original Poster
Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl - Parsing HTML fails rjcrews Programming 5 06-15-2006 09:19 PM
HTML parsing library Dark_Helmet Programming 1 04-27-2006 07:43 AM
HTML parsing library nodger Programming 1 09-01-2005 01:42 AM
HTML parsing with HTML::TreeBuilder smaida Programming 0 07-10-2005 09:58 PM
Parsing HTML using Perl smaida Programming 2 05-29-2004 01:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration