This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
kurs:3._einheit [2009/03/19 10:25] mh |
kurs:3._einheit [2010/06/01 10:24] mh |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Regular Expressions ===== | ||
+ | === Auswertung eines LogFiles === | ||
+ | |||
+ | * regexp | ||
+ | * hashes | ||
+ | * [[hash by value sortieren]] | ||
+ | * auslesen der IP Adresse & Auswertung welche wie oft vorkommt | ||
+ | * {{wiki:main.log}} | ||
+ | * {{wiki:apache.log}} | ||
+ | * {{wiki:woerterbuch.txt}} | ||
+ | * [[loganalyze.pl]] | ||
+ | |||
+ | === extrahieren der TLD einer email Adresse === | ||
+ | | ||
+ | [[email.pl]] | ||
+ | |||
+ | === Ermitteln einer g�ltigen Postleitzahl === | ||
+ | |||
+ | [[plz.pl]] | ||
+ | |||
+ | === Ausmaskieren von Zeichen deren ASCII Wert größer 127 ist === | ||
+ | |||
+ | <code> | ||
+ | use strict; | ||
+ | use warnings; | ||
+ | |||
+ | |||
+ | my $t = 'öäü'; | ||
+ | |||
+ | my $text = "häuser österreich übersiedeln\n"; | ||
+ | |||
+ | ## $text =~ s/[öüä]//g; | ||
+ | |||
+ | my @a = split '', $text; | ||
+ | # $" = "\n"; | ||
+ | # print "@a"; | ||
+ | |||
+ | my @b = map {ord($_) < 127 ? $_ : sprintf "&#%d;", ord($_) } @a ; | ||
+ | |||
+ | my $b = join '', map {ord($_) < 127 ? $_ : sprintf "&#%d;", ord($_) } split '', $text; | ||
+ | ## '&#'.hex(ord($_)).';' } @a; | ||
+ | print $b; | ||
+ | # print "\n"; | ||
+ | print $text; | ||
+ | |||
+ | $text =~ s/(.)/ord($1) < 127 ? $1 : sprintf "&#%d;", ord($1)/eg; | ||
+ | |||
+ | print $text; | ||
+ | </code> |