Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: extracting attribute from HTML tag

by svsingh (Priest)
on May 26, 2003 at 06:37 UTC ( [id://260782]=note: print w/replies, xml ) Need Help??


in reply to extracting attribute from HTML tag

If that's all you're trying to do, then a simple string match should work for you. For example:
$s = "(<a class='team' href='javascript:void(0)' title='(PEN.66) O FLY +NN RILEY (51)'>"; $s =~ /title='([^']+)'/; print "title: $1\n";

That returns:

title: (PEN.66) O FLYNN RILEY (51)

For other similar examples, you may want to check out Teach Yourself Perl in 21 Days: Day 10 (img.pl). That example shows a decent (but not comprehensive) way to extract attributes from HTML tags.

Hope this helps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://260782]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found