RegexWars
Tier 1 · Sorcerermatch

Four Octets

Match a valid IPv4 address — four numbers 0 to 255, separated by dots, and nothing else.

The hard part is not the shape, it is the range. 255 is valid and 256 is not, which no quantifier can express — you have to enumerate the ranges by their leading digits. Leading zeros are not accepted.

Your pattern0 chars · par 75
//
Flags
Start typing — tests run as you go.0 of 7 visible tests passing
Test cases
  • 192.168.0.1must match
  • 255.255.255.255must match
  • 0.0.0.0must match
  • 256.1.1.1must not match

    out of range

  • 1.2.3must not match

    only three octets

  • 1.2.3.4.5must not match
  • 01.2.3.4must not match

    leading zero

+ 12 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.