Re: [PHP] Regular Expresion Work on IP address

2002-12-05 Thread DL Neil
Dev, Nice work! Thanks for implementing the book's algorithm/proving it in PHP-PCRE, and I do like your extension into an internal/external function. I've not implemented your code (bookmarked for later) but some initial comments: - don't forget some of the other 'funnies' in the IP addressing sc

Re: [PHP] Regular Expresion Work on IP address

2002-12-04 Thread Dev
Well after reading John'ss and DL Neil's replys i came up with 2 functions. The first is to check to see if the entry is a valid IP address and the Next is to determine if it is a Private Network IP or not!. You can see this in action at: http://www.my-tangled-web.net/codebank/code/ip_check.php a

Re: [PHP] Regular Expresion Work on IP address

2002-12-04 Thread DL Neil
John, > I think it'd be hard to verify the range with a regex. ip2long and long2ip > do not validate. So, an option would be to write your own little function > that splits the $ip on the period, verifies there are 4 parts, then checks > that each part is between 1 and 255 inclusive. My other po

Re: [PHP] Regular Expresion Work on IP address

2002-12-04 Thread DL Neil
Hello Dev, > Now I am continuing on with the same script and I need to check for valid > IP address form. > Currently I have: > > $ip="255.255.255.0"; > if (preg_match ("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/", $ip)) { > print "Good Ip"; > } else { > print "Bad Ip"; > } > > Thi

Re: [PHP] Regular Expresion Work on IP address

2002-12-04 Thread 1LT John W. Holmes
> Now I am continuing on with the same script and I need to check for valid > IP address form. > Currently I have: > > $ip="255.255.255.0"; > > if (preg_match ("/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/", $ip)) { > print "Good Ip"; > } else { > print "Bad Ip"; > } > > This does wor