IPv4 Address

Matches a valid IPv4 address.

Contributed by @itsbrunodev

regex
^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
sh
# Valid IPv4 addresses
123.3.123.89
255.255.255.0
 
# Invalid IPv4 addresses
999.999.999.999
12.3.456
192.168.1.257

Keywords

ipv4
address
ip
network