How could one convert this to Python? The regex is used to match ipv4 addresses, but is there a better way to match this?
if ($line =~ m{\s+id\s+(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}),\s+data\s+(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}),\s+Type Transit\s+(\d{1,2})}) {
$id = "$1.$2.$3.$4";
$data = "$5.$6.$7.$8";
}
1 Answer