Thread Nur tatsächliche Texte aus HTML parsen (21 answers)
Opened by Nordlicht at 2007-05-09 20:04

renee
 2007-05-11 12:48
#29005 #29005
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
@Froschpopo:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use strict;
use warnings;

local $/;
my $html = <DATA>;
(my $neu = $html) =~ s/<[^>]*>//gs;
print $neu;

__DATA__
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
     "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Frosch Test</title>
</head>
<body>
  <div>Die Bedingung <pre>4 < 5 </pre> ist wahr!</div>
</body> 
</html>


Ausgabe:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
fral20857@fral20857:~$ perl froschpopo.pl 



Frosch Test


Die Bedingung 4 ist wahr!


fral20857@fral20857:~$
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 Nur tatsächliche Texte aus HTML parsen