I want to verify whether a given string is valid IPv4 address or not in ruby. I tried as follows but what is does is matches values greater than 255 as well. How to limit each block's range from 0-255
str="255.255.255.256"
if str=~ /\b[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\b/
puts true
else
puts false
end