write a program to the given ip is valid private address or not(192.168.1.1)?

Answer Posted / amarnath

#10.0.0.0 through 10.255.255.255




#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

set ip 192.168.10.1

if {[regexp {^(10|169|172|192).([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])} $ip match 1st 2nd 3rd 4th]} {
puts $match
puts "$1st
$2nd
$3rd
$4th" }

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi all, Is there any certification exams available for TCL and Perl. If so please let me know, my mailid is vpbharathi@gmail.com. Thanks in advance, Bharathi.P

2612