Subnet Mask Regular Expression

Category: URI

A regular expression to match a Subnet Mask, which is a logical subdivision of an IP network.

/^(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(?:\.(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){3}$/

IP Address (V4) Examples:

  • 255.255.255.0
  • 255.224.0.0

See Also:

Rate This Regex
Sending
User Review
1 (1 vote)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.