/^/
ExpertValidation

Strict IPv4 Address Validator

Write a regex that validates an IPv4 address, ensuring each of the four dot-separated octets is a real number between 0 and 255, rather than just any string of digits.

//
192.168.1.1 / 255.255.255.255 / 0.0.0.0 / 256.1.1.1 / 192.168.1 / 999.999.999.999

Test cases

  • 192.168.1.1expect match
  • 255.255.255.255expect match
  • 0.0.0.0expect match
  • 256.1.1.1expect no match
  • 192.168.1expect no match
  • 192.168.1.1.1expect no match
  • 999.999.999.999expect no match