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.

Need a syntax reminder? Read our detailed guide on the Strict IPv4 Address Validator Regex Pattern.

//
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.1
  • 255.255.255.255
  • 0.0.0.0
  • 256.1.1.1
  • 192.168.1
  • 192.168.1.1.1
  • 999.999.999.999

How to Solve this Regex Challenge

To complete the Strict IPv4 Address Validator challenge, you must write a regular expression pattern that satisfies all specified test cases.

Steps to Complete:

  1. Analyze the Requirements: Read the description and review the list of test cases below. Identify which strings must be matched (green markers) and which must be rejected (red markers).
  2. Draft Your Pattern: Enter your regex in the interactive editor. Use the provided Hint button if you get stuck.
  3. Verify: The test cases panel will update in real-time as you type, showing which strings match your current expression.
  4. Review the Solution: Once you successfully pass all test cases, review the explanation to understand the logic behind the solution.