Thread Tags suchen und auswerten (3 answers)
Opened by Gast at 2005-01-06 00:42

renee
 2005-01-06 11:31
#4011 #4011
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code mit CPAN:HTML::Parser:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/perl

use strict;
use warnings;
use HTML::Parser;

my $string = qq~.:<script>text</script> .:<script>text34</script> <div class="bbcode">sammler schrieb:</div>~;
my $p = HTML::Parser->new();
$p->handler(start => \&start_handler,"tagname,self");
$p->parse($string);

sub start_handler{
 return if(shift ne 'script');
 my $self = shift;
 my $text;
 $self->handler(text => sub{$text = shift;},"dtext");
 $self->handler(end  => sub{print $text,"\n\n" if(shift eq 'script')},"tagname");
}
\n\n

<!--EDIT|renee|1105003948-->
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 Tags suchen und auswerten