Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Having a problem with negative look behind assertion

by manorhce (Beadle)
on Feb 12, 2013 at 13:40 UTC ( #1018360=note: print w/ replies, xml ) Need Help??


in reply to Having a problem with negative look behind assertion

You don't have fixed width of line, look behind or look ahead will only work on fixed width

use strict; use warnings; while(my $line = <DATA>) { chomp($line); if( $line =~ /(?<!fee\/src\/)(com\/)/ ) { print $line . "\n"; } } __DATA__ foo/src/com/ foo/src/com/ foo/src/com/ fee/src/com/


Comment on Re: Having a problem with negative look behind assertion
Download Code
Re^2: Having a problem with negative look behind assertion
by ww (Bishop) on Feb 13, 2013 at 00:10 UTC
    Sorry, but that's half wrong. See perldoc perlretut which makes it very clear: look aheads need NOT be fixed width; only the look behind flavor.

    If you didn't program your executable by toggling in binary, it wasn't really programming!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018360]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-07-06 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls