/ Published in: Regular Expression
URL: http://reusablecode.blogspot.com/2008/07/isvalidip.html
A more robust and elegant regular expression for checking IP addresses than the ones previously available here on Snipplr. Each octet is guaranteed a valid number between 0 and 255, and the three trailing octets are grouped to minimize pattern length. See the corresponding blog post for ASP and PHP functions that implement this pattern. (Also available here on Snipplr.)
Expand |
Embed | Plain Text
"^([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){3}$
You need to login to post a comment.
