in reply to Regex for IP and Optional Port
I'd go for something like this:
(Untested but should be roughly right)my ($ip1, $port1, $ip2, $port2) = ($inLine =~ m|^from ([0-9.]+)/?([0-9]*) to ([0-9.]+)/?([0-9]*) on in +terface$|)
hth,
andy.
update: changed the delimiter for obvious reasons
|
|---|