in reply to Zero-width look-ahead regexp question

$ perl -le' for ( qw/ ABCXYZ FOOXXXYZ FOOXXXBAR FOOXXXBAZ / ) { print if /^FOO.*(?<!BAR|BAZ)$/; } ' FOOXXXYZ

Replies are listed 'Best First'.
Re^2: Zero-width look-ahead regexp question
by massa (Hermit) on Jul 01, 2008 at 12:30 UTC
    Your answer is more like what rovf says he wants (FOO ... things things ... must not be BA[RZ] ... end) but differ from the regexen he presented initially:
    /^FOO(.*)$/ and $1 !~ /^BA[RZ]$/ mean (FOO ... things things ... end AND "things things" must not be BA[RZ]). The difference is that your answer does not FOOMABAR, and his expression does match it.
Re^2: Zero-width look-ahead regexp question
by rovf (Priest) on Jul 01, 2008 at 12:16 UTC
    This is a cute idea!!!
    -- 
    Ronald Fischer <ynnor@mm.st>