IP address
Posted: Thu Aug 18, 2011 5:59 am
Hi,
I am trying to match the first half of an IP address using:
preg_match_all('![0-9]*.[0-9]*.!',"$ip", $matches);
This however seems to find a match for each level of the address and the period. If I input '255.255.255.0' I want the match to be: '255.255'.
I don't think I am far away, is it possible?
Thanks,
I am trying to match the first half of an IP address using:
preg_match_all('![0-9]*.[0-9]*.!',"$ip", $matches);
This however seems to find a match for each level of the address and the period. If I input '255.255.255.0' I want the match to be: '255.255'.
I don't think I am far away, is it possible?
Thanks,