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.
In reply to Re: IP Address/Subnet matching
by starbolin
in thread IP Address/Subnet matching
by adenardo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |