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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parsing html data

Status
Not open for further replies.

leroy07

Programmer
Joined
Apr 10, 2007
Messages
5
Location
AU
I have a webpage, and I want to connect (using LWP::Simple or LWP::Useragent) and get whatever strings between each occurence of a certain tag.
 
What have you tried so far? Post it, and we'll have a look at it...

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::PerlDesignPatterns)[/small]
 
I think we need a new abbreviation: WHYTSF? [wink]

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I haven't written any code because I don't know where to start, I know how to get whatevers between the first occurence of a tag, but I don't know how to do it for ALL the tags.
 
See if one of these tutorials helps:

perlrequick - Perl regular expressions quick start
perlretut - Perl regular expressions tutorial

can be found here:






------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I know how to do regular expressions but if I do m/<title>(.*?)<\/title>/ (example) that will only get the first one, i need to get them all.
 
add the global matching modifier.

Code:
[url=http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/url] [blue]@titles[/blue] = [red]m{[/red][purple]<title>(.*?)</title>[/purple][red]}[/red][red]g[/red][red];[/red]

It's the "g" at the end that is your baby.

- Miller
 
I know how to do regular expressions

Evidently not well enough. Go back and read the tutorials. [smile]

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Ouch...Kevin is turning the heat on these days...
 
I didn't mean to come across as rude or condescending to leroy07. If it reads that way I apologize to him. But it does look as though he can benefit from reading the tutorials.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top