Thread alle image sources aus html datei rausfiltern (7 answers)
Opened by kölsch at 2004-01-07 19:58

pq
 2004-01-08 15:46
#770 #770
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
und wenn du es richtig machen willst, benutzt du, um HTML zu parsen, keine regex,
sondern ein modul. es heisst, oh wunder, HTML::Parser.
Code: (dl )
1
2
3
4
5
6
7
8
9
10
use HTML::Parser ();
my $p = HTML::Parser->new(
 api_version => 3,
 start_h => [\&start, "tagname, attr"],
 marked_sections => 1,
);
$p->parse_file("datei.html");
sub start {
 print "$_[1]->{src}" if $_[0] eq "img"
}
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread alle image sources aus html datei rausfiltern