I have a list of filters that's about 60 lines of:
$string !~ /foo/i &&
$string !~ /bar/i &&
...
I read this suggestion, but I'm not entirely sure that it's the same thing or that I understand it properly:
$string =~ m {
^(?!.*(
foo |
bar
)).*$
}xi
I'm using
m{ }xi to make it more legible, and I understand that part. What throws me off is the negative look-ahead. I guess it's sorta... match if the string doesn't contain foo or bar, but is followed by
.* ?
Are these two variations doing the same thing?
My goal is to make the file a smidge smaller, and make it a little easier for me to maintain long term. Processing speed isn't a huge concern for this script unless it's a LOT slower... microseconds won't really matter, though.