Thread Regulärer Ausdruck mehrmals pro String (3 answers)
Opened by Gast at 2005-12-26 02:30

renee
 2005-12-26 02:58
#61370 #61370
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/bin/perl
use strict;
use warnings;
use HTML::Parser;

my @images;
my $string = qq~<img src="url1">xxxxxxxx <img src="url2">~;

my $p = HTML::Parser->new();
$p->handler(start => \&start_handler,"tagname,attr,self");
$p->parse($string);

print $_,"\n" for(@images);


sub start_handler{
return if(shift ne 'img');
push(@images,shift->{src});
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Regulärer Ausdruck mehrmals pro String