Created
November 4, 2013 12:07
-
-
Save egulhan/7301600 to your computer and use it in GitHub Desktop.
IPv4 block IP PHP regex pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$patt='/^([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]){1}(\.|\.[1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]){0,3}$/'; | |
/** | |
* Valid IP address examples: | |
* | |
* 192.168.1.1 | |
* 192.168. | |
* 192.168 | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment