kgimpel has asked for the wisdom of the Perl Monks concerning the following question:
I am passing a positive regex as a string argument to another function, and I'd only like to match on lines that don't contain "bar."
IE:
INPUT looks like this:
foo
"bar" blah
"test" blah
"test2"
MATCHES should be:
foo
"test" blah
"test2"
So, I effectively want to do this
$_ !~ /bar/
but I cannot change the logic to do it.
I've tried
/.*?(?!bat)/
but I think the line taken as a whole,
^.*bar.*$
satifies n-characters not followed by "bar," so we get a positive match. Can anyone suggest pattern for this?
Thanks in advance.
Back to
Seekers of Perl Wisdom