Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: How to extract text present in 3 lines within the HTML tags

by ambrus (Abbot)
on May 17, 2011 at 15:04 UTC ( #905293=note: print w/replies, xml ) Need Help??


in reply to How to extract text present in 3 lines within the HTML tags

Come on, just use a real full HTML parser.

use warnings; use XML::Twig; our $doc = q( <title> This is a very good site for regular Expressions. Very helpful. Thanks. </title> <p> Some other text we don't want to extract. ); my $twig = XML::Twig->new; $twig->parse_html($doc); my($title_elt) = $twig->findnodes("//title"); my $title = $title_elt->trimmed_text; print "$title\n" __END__

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2023-12-04 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (25 votes). Check out past polls.

    Notices?