Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Having a problem with negative look behind assertion

by Athanasius (Chancellor)
on Feb 12, 2013 at 12:41 UTC ( #1018349=note: print w/replies, xml ) Need Help??

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/ foo/src/com/stuff/ foo/src/com/stuff/ fee/src/com/stuff/ fee/src/com/stuff/


22:32 >perl foo/src/com/stuff/ foo/src/com/stuff/ 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,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018349]
[Corion]: marto: Naah, I'm avoiding that rabbit hole ;) Sometimes I think of using Perl to create MIDI to generate music, or at least the harmonies to which I could jam, but then that would eat even more into available time ;-))

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2017-07-27 07:53 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (404 votes). Check out past polls.