in reply to IP Address/Subnet matching

Reading Don't Use Regular Expressions To Parse IP Addresses! first:

1) Convert the dotted-quad forms to integers.
2) Select the appropriate netmask.
3) Logical AND with the netmask to generate a subnet.
4) Exclusive -or two subnets to compare them.

If you think of the subnets as bitmasks, comparing them with host addresses is trivial.


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}