Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: meta parsing problems

by Ctrl-z (Friar)
on May 23, 2004 at 22:54 UTC ( #355783=note: print w/replies, xml ) Need Help??


in reply to meta parsing problems

this isnt fool proof, but it'll probably do what you want...
foreach( $content =~ m#<meta (.*?)>#sgoi ) { my $name = $1 if( $_ =~ m#name\s*?=\s*?["'](.*?)["']#sgoi); my $cont = $1 if( $_ =~ m#content\s*?=\s*?["'](.*?)["']#sgoi); }



time was, I could move my arms like a bird and...

Replies are listed 'Best First'.
Re^2: meta parsing problems
by Anonymous Monk on Oct 20, 2007 at 11:33 UTC
    Eventhough the thread's a bit old... There are problems with this approach. You should rellay consider using HTML::TreeBuilder, it's as easy as
    use HTML::TreeBuilder; my $tree = HTML::TreeBuilder->new()->parse($data); for my $tag ($tree->look_down( _tag => "meta")) { $kWords{$tag->attr("name")} = $tag->attr("content"); }
    The above code takes care of spaces/linebreaks &s.o. And its fast and widely used. Just my 5cents. FJ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2020-06-04 06:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (30 votes). Check out past polls.

    Notices?