i am trying to write a regexp which will check whether the ip is valid or not.Facing issue when i give 256 as value it is still matching 2, and reg will store the value as 1 since the pattern is matched.
set ip "256.256.255.1"
set reg [regexp -all{^([1-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([1-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([1-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).([1-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])} $ip match ]
puts $reg