Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTML::Tree

Status
Not open for further replies.

sulfericacid

Programmer
Aug 15, 2001
244
0
0
US
I was wondering if someone could help with a free HTML::Tree questions and a regex question.

I'm using:

use strict;
use CGI qw/:standard/;

use HTML::Tree;
use LWP::Simple;

print header, start_html('test printing');

my $count;
until ($count eq "120") {
$count++;
my $funky = "
my $content = get($funky);

my $tree = HTML::Tree->new();

$tree->parse($content);


print $tree->as_text;
}


A test print looks like:

Chat at Allpoetry.com Tired of the same old? Over 300 creative dates for $20 or less! click here! Hello. Login or Register? PoemsPoetsContestsColumnsClassAdd linesFunBulletinStoreHelp Chatter Archives< Previous Chatter | Next Chatter >JacobGrimm: Well, I only joined in May, so I know nothing of the &quot;old site&quot;. (19 minutes ago) JacobGrimm: Or rather, however it came to disappear. Maybe of blAck-roSe-aL's own volition... (20 minutes ago) Redstormy: I'm am just frustrated because I thought this would be better than the old site. (20 minutes ago) Seven Years: lol (20 minutes ago) JacobGrimm: Hmm. Kudos to the Mod who got rid of that comment. (21 minutes ago) JacobGrimm: Red you can't blame the site. Servers aren't flawless. Sadly. (22 minutes ago) JacobGrimm: No problem. (23 minutes ago) Seven Years: I'm new... just today (23 minutes ago)

I was wondering how I could set it up to only print things from a regex. I'm trying to print just the usernames, the text, and the time ago. or..
Seven Years: I'm new... just today (23 minutes ago).

Can someone give me a regex to print a username that can contain alphanumeric and hyphens/spaces/pretty much everything that is followed by a single colon then X spaces and prints all the text until it reaches the closing set of ) ?

Thanks for your help!

&quot;Age is nothing more than an inaccurate number bestowed upon each of us at birth as just another means for others to judge and classify us- sulfericacid
 
$_ = &quot;JacobGrimm: Hmm. Kudos to the Mod who got rid of that comment. (21 minutes ago) JacobGrimm: Red you can't blame the site. Servers aren't flawless. Sadly. (22 minutes ago) JacobGrimm: No problem. (23 minutes ago) Seven Years: I'm new... just today (23 minutes ago)&quot;;

@comments = m/[^:]+: [^:]+\([\d]+ minutes ago\) /g;

foreach $comment (@comments) {

print &quot;$comment&quot;;

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top