in reply to Negative expressions with alternation in ProxyRemoteMatch
Try negative look ahead.
my @str = qw/ a.jpg b.gif c.png d.txt e.jpeg a.jpg.3 /; for my $str (@str) { if ($str =~ /.*?\.(?!gif|jpe?g)/) { print "matched: $str\n"; } } __END__ # output is matched: c.png matched: d.txt matched: a.jpg.3
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Negative expressions with alternation in ProxyRemoteMatch
by redhotpenguin (Deacon) on Aug 30, 2005 at 07:21 UTC | |
by Roger (Parson) on Aug 30, 2005 at 08:58 UTC |
In Section
Seekers of Perl Wisdom