Write a solution to validate an IPv4 address.
IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots, e.g., 172.16.254.1
For valid IPv4 addresses return true
and for invalid addresses return false
.
Below are some valid IPv4 addresses:
15.80.5.20
, 255.255.255.255
, 1.0.0.1
Below are some invalid IPv4 addresses:
192.abc.0.16
, 100.256.10.60
, 10.15.10