I want to be able to extract the '192.168.100.0 0.0.0.255' out of the below text.
my $entry = 'permit ip host 10.11.1.1 192.168.100.0 0.0.0.255'; while ($entry =~ /(?:host){0}\s+(\d+\.\d+\.\d+\.\d+)\s+(\d+\.\d+\.\d+\ +.\d+)/g){ # do something with $1 and $2 }
I need to find every occurrence of these two network and mask combinations. So basically if the entry is
permit ip host 10.11.1.1 192.168.100.0 0.0.0.255I want to pull out
192.168.100.0 0.0.0.255but if the entry is
permit ip 10.11.1.0 0.0.0.255 192.168.100.0 0.0.0.255I want to pull out
10.11.1.0 0.0.0.255 192.168.100.0 0.0.0.255
Why doesn't {0} match zero times like I expect it to?
In reply to Match zero times in regex by SomeNetworkGuy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |