use strict; use warnings; my $mask = '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'; while (<DATA>) { chomp; if (@_ = m/permit ip(?: host)?\s+($mask)\s+($mask)\s+($mask)(?:\s+ +($mask))?$/) { no warnings 'uninitialized'; if ($2 eq '192.168.100.0' && $3 eq '0.0.0.255' || $3 eq '192.168.100.0' && $4 eq '0.0.0.255') { print "@_\n"; } } } __DATA__ permit ip host 10.11.1.1 192.168.100.0 0.0.0.255 permit ip 10.11.1.0 0.0.0.255 192.168.100.0 0.0.0.255
In reply to Re: Match zero times in regex
by TJPride
in thread Match zero times in regex
by SomeNetworkGuy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |