I need a regular expression which consist of: 1-3 digits and optional dot. It is something like IP pattern. I want my regex to allow the following:
192
192.
192.168
192.168.
and NOT the following:
192.1688
This is what I have so far:
preg_match('/^((\d{1,3})(\.?))+$/', $string);
But it still allows me to have more than 3 digits. Any suggestions how to fix the regex?