write a program to the given ip is valid private address or not(192.168.1.1)?
Answer Posted / saravanan6060
#169.254.0.0 through 169.254.255.255
#172.16.0.0 through 172.31.255.255
#192.168.0.0 through 192.168.255.255
#10.0.0.0 10.255.255.255
set a "10.78.80.2" or
// a could be any private range the below regexp will match ,if u provide other than private range it will throw an error
regexp {^(10|169|172|192).([0-9]+|[0-9][0-9]+|1[0-9][0-9]+|2[0-4][0-9]+|25[0-5]+).([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]|[0-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])} $a match
puts $match
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers