Thread Negierte Teilausdrücke eines regulären Ausdrucks
(4 answers)
Opened by Tim at 2012-01-28 13:04 Guest Tim Hi, das ! hat im regulären Ausdruck nicht die Bedeutung "nicht". Es geht z.B. so: Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 use strict; use warnings; my @strings = qw(aalglatt Saarland11); for my $string (@strings) { if ($string =~ /aa|bb|cc/ and $string !~ /11|22|33/) { print "OK: $string\n"; } } Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? -- Brian Kernighan: "The Elements of Programming Style"
|