in reply to Having a problem with negative look behind assertion
I would say only Athanasius has a correct answer yet, I see mistakes in the other answers. So I made sure and tested. This should work (and still uses only one regex):
if( $line =~ /^(?!fee).*[Bb]ar.*\.java/ )
This is a negative look-ahead fixed at the start of the line (with ^).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Having a problem with negative look behind assertion
by SirClive (Scribe) on Feb 12, 2013 at 14:25 UTC | |
|
Re^2: Having a problem with negative look behind assertion
by Anonymous Monk on Feb 12, 2013 at 14:14 UTC | |
by jethro (Monsignor) on Feb 12, 2013 at 14:46 UTC | |
by Anonymous Monk on Feb 12, 2013 at 14:51 UTC |