in reply to Having a problem with negative look behind assertion
Just use two regexen:
#! perl use strict; use warnings; while (my $line = <DATA>) { chomp $line; print "$line\n" if $line =~ / [Bb]ar .* \. java $ /x && $line !~ / ^ fee /x; } __DATA__ foo/src/com/stuff/xxxxxx.java foo/src/com/stuff/ggbargg.java foo/src/com/stuff/ggBargg.java fee/src/com/stuff/ggbargg.java fee/src/com/stuff/ggBargg.java
Output:
22:32 >perl 531_SoPW.pl foo/src/com/stuff/ggbargg.java foo/src/com/stuff/ggBargg.java 22:37 >
Hope that helps,
Update: No need for $line:
while (<DATA>) { chomp; print "$_\n" if / [Bb]ar .* \. java $ /x && !/ ^ fee /x; }
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
---|
In Section
Seekers of Perl Wisdom