Thread Regex - Suche nach Tags (7 answers)
Opened by YAPD at 2021-06-01 18:31

hlubenow
 2021-06-01 18:58
#193337 #193337
User since
2009-02-22
875 articles
BenutzerIn
[default_avatar]
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl

use warnings;
use strict;

use HTML::TokeParser;

my $filename = "test.html";

my $p = HTML::TokeParser->new($filename);
 
while (my $token = $p->get_tag("a")) {
    my $url = $token->[1]{href} || "-";
    my $text = $p->get_trimmed_text("/a");
    print "$url\t$text\n";
}

View full thread Regex - Suche nach Tags