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,
IP address
Moderator: General Moderators
Re: IP address
/[0-9]{1,3}\.[0-9]{1,3}/
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.