Combine them:
while (chomp($_ = <TOPARSE>)) { next unless /\d+\s+(\d+)\s+(1\.2\.3\.4)\s+->\s+(4\.3\.2\.1)\s+(?!TC +P)([^\s]+)\s+(3456)\s+>\s+(113)/; print; }
That way, you get the best of both worlds. You just do a negative lookahead (?!) AND a protocol gulper (like ([^\s]+), and you can still search for all your other strings that you want to search for.
This will match on source 1.2.3.4 and destination of 4.3.2.1, but will make sure it is not a TCP packet. Best of both worlds...
Update: Per chromatic's and tye's recommendations, my proposed code would look like this:
while (<TOPARSE>) { next unless /^\d+\s+(\d+)\s+(1\.2\.3\.4)\s+->\s+(4\.3\.2\.1)\s+(?!T +CP\s)([^\s]+)\s+(3456)\s+>\s+(113)/; print; }
In reply to Re: Runtime Regexp Generation
by perlguy
in thread Runtime Regexp Generation
by tekkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |